Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Business Layer Generator and Computed DateTime Fields
Message
De
18/02/2011 10:27:43
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
18/02/2011 09:41:15
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01500696
Message ID:
01500716
Vues:
29
>>>Hi,
>>>
>>>MM.NET 3.6
>>>
>>>I have two computed datetime fields on table in my SQL Server database. When I run the Business Layer Generator, this code gets generated in the BO.cs:
>>>
>>>
		protected override void HookSetDefaultValues(PolicyHeaderEntity entity)
>>>		{
>>>			if (this.DefaultValues != null)
>>>			{
>>>				// Store the dynamic default values via the entity object
>>>				entity.DatePaidTo = Defaults.DatePaidTo;
>>>				entity.PremiumDue = Defaults.PremiumDue;
>>>			}
>>>
>>>But these fields are set to accept null values and I also cleared out the defaults for these fields in the generator. Of course this code causes an error:
>>>
>>>"Property or indexer 'SamaanSystems.IAS.Business.PolicyHeaderEntity.DatePaidTo' cannot be assigned to -- it is read only"
>>>
>>>For now I am just deleting the code, but is this a bug in the generator or is there something else I need to do?
>>
>>Frank, It is fine to just remove these two lines if you don't need them. My guess is the generator didn't have logic to determine the type of fields they were in the Database. I would have thought you could have set them to not Required in the BLG though if they were set to accept nulls.
>>Tim
>
>for some reason, the required and set default checkboxes are not there when you select these fields, only the default value text box which I cleared out but still got the generated code

That is why you got the properties added to the Defaults class then. I guess just something to note about how it works. Probably just doesn't have any ability to determine more about the field. You could remove those from the Defaults class also if you wanted.
Tim
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform