Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetEntity() not working
Message
From
03/09/2009 09:56:49
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
02/09/2009 17:29:03
Alvin Schmucker
Choice Books of Northern Va
Virginia, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01422353
Message ID:
01422434
Views:
55
>I ran the Business Layer Generator, then customized my Employee class with a GetEmployeeByEmpID(int EmpID) as shown:
>
>		public EmployeeEntity GetEmployeeByEmpID(int empid)
>		{
>			return this.GetEntity("EmployeesSelectByPK", this.CreateParameter("@EmpID", empid));
>		}
>
>
>Calling this results in a NullReferenceException was handled message with detail being "Object reference not set to an instance of an object". I went to the trouble of loading the MM debugging symbols, etc so the debugger could step through the MM source code. It turns out that this section of code in the mmAppBase class is the problem:
>
>		/// <summary>
>		/// Database Manager property
>		/// </summary>
>		public static mmDatabaseManager DatabaseMgr
>		{
>			get	
>			{ 
>				// Instantiate the Database Manager if it's null
>				if ( _databaseMgr == null )
>				{
>					_databaseMgr = Factory.CreateDatabaseManager();
>				}
>				return _databaseMgr; 
>			}
>			set { _databaseMgr = value; }
>		}
>		private static mmDatabaseManager _databaseMgr = null;
>
>
>The Factory referenced above when calling Factory.CreateDatabaseManager() is null. What is the problem here?

Alvin,
Are you working on a web or windows application? What Database are you using? Do you have a Factory in your UI project? Have you overridden the Create Factory method? Typically the mmAppBase CreateFactory is overridden in your specific app class so it will create a local Factory object. Also, in your ABusiness object what do you have set for the property DefaultCommandType?
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform