It seems the generated code has an invalid setting for the DefaultValue for boolean properties in C#:
[Bindable(true, BindingDirection.TwoWay)]
[Editable(true)]
[Display(Name="Promoted", AutoGenerateField=true)]
[IbVal.ValidateProperty]
[IbVal.RequiredValueVerifier()]
[IbCore.DBDataType(typeof(Boolean))]
[DefaultValue(False)]
[MsSer.DataMember]
public Boolean Promoted {
get { return PromotedEntityProperty.GetValue(this); }
[global::System.Diagnostics.DebuggerNonUserCode]
set { PromotedEntityProperty.SetValue(this, value); }
}
Notice the upper case False. A lower case false works fine. A simple find and replace has fixed it for me. Am I doing something wrong though? Is my mapping file wrong somewhere? Thanks, Simon.
|
Also, I am getting this error when I try to run the app:
Assembly Initialization method GcsAg.DomainModel.Test.AssemblyInitialization.AssemblyInit threw exception. IdeaBlade.EntityModel.EntityServerException: IdeaBlade.EntityModel.EntityServerException: Error loading entity relations ---> IdeaBlade.Core.IdeaBladeException: Error loading entity relations ---> System.InvalidCastException: Invalid cast from 'System.Boolean' to 'System.Nullable`1[[System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.. Aborting test execution.
System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
System.Boolean.System.IConvertible.ToType(Type type, IFormatProvider provider)
System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
IdeaBlade.EntityModel.DataEntityProperty.UpdateDefaultValue()
IdeaBlade.EntityModel.DataEntityProperty..ctor(Type entityType, String propertyName, Type dataType, Boolean isNullable, Boolean isPartOfKey, ConcurrencyStrategy concurrencyStrategy, Boolean isAutoIncrementing, VerificationSetterOptions verificationSetterOptions, Boolean isNativeProperty)
ctor(String propertyName, Boolean isNullable, Boolean isPartOfKey, ConcurrencyStrategy concurrencyStrategy, Boolean isAutoIncrementing, VerificationSetterOptions verificationSetterOptions, Boolean isNativeProperty)
ctor(String propertyName, Boolean isNullable, Boolean isPartOfKey, ConcurrencyStrategy concurrencyStrategy, Boolean isAutoIncrementing, VerificationSetterOptions verificationSetterOptions)
GcsAg.DomainModel.Contact..cctor() in C:\_dev\GcsAg090720\GcsAg.DomainModel\GcsAg.DomainModel.ServerModel.Designer.cs: line 16264
IdeaBlade.EntityModel.EntityServerProxy.CheckConnection(Exception e)
IdeaBlade.EntityModel.EntityServerProxy.Fetch(SessionBundle bundle, IEntityQuerySurrogate query)
IdeaBlade.EntityModel.EntityManager.ExecuteServerQuery(IEntityQuerySurrogate pEntityQuery)
IdeaBlade.EntityModel.EntityManager.HandleEntityServerException(Exception pException, Boolean pTryToHandle, PersistenceOperation pOperation)
IdeaBlade.EntityModel.EntityManager.ExecuteServerQuery(IEntityQuerySurrogate pEntityQuery)
IdeaBlade.EntityModel.EntityManager.ExecuteFetch(IEntityFinder finder)
IdeaBlade.EntityModel.EntityQueryFinder.Execute()
IdeaBlade.EntityModel.EntityManager.ExecuteQueryCore(IEntityQuery query, Boolean isAsync)
IdeaBlade.EntityModel.EntityManager.ExecuteQuery(IEntityQuery query)
GcsAg.DomainModel.DomainModelEntityManager.InitializeCache() in C:\_dev\GcsAg090720\GcsAg.DomainModel\DomainModelEntityManager.cs: line 235
GcsAg.DomainModel.DomainModelEntityManager.InitializeEntityManagerOnServer() in C:\_dev\GcsAg090720\GcsAg.DomainModel\DomainModelEntityManager.cs: line 44
GcsAg.DomainModel.DomainModelEntityManager.InitializeEntityManager() in C:\_dev\GcsAg090720\GcsAg.DomainModel\DomainModelEntityManager.cs: line 30
GcsAg.DomainModel.Test.AssemblyInitialization.AssemblyInit(TestContext context) in C:\_dev\GcsAg090720\GcsAg.DomainModel.Test\AssemblyInitialization.cs: line 17
|
As a point of order, the bug with nullable types may well be a bug, but it is also a bug on our end because the fields are boolean but have not been marked as NOT NULL in the database when they should have been.
Thanks kimj, your responses are always quick and helpful.
|