Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Business Layer Generator and Computed DateTime Fields
Message
From
18/02/2011 09:27:59
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
18/02/2011 09:04:44
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01500696
Message ID:
01500699
Views:
34
>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
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform