Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetEntity() not working
Message
De
03/09/2009 09:56:49
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
02/09/2009 17:29:03
Alvin Schmucker
Choice Books of Northern Va
Virginie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01422353
Message ID:
01422434
Vues:
56
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform