>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