Hello folks,
Im using the Fluent NHibernate together with the automapping functionality now im lookin' for something like a [ReadOnlyDbField] custom-attribute for a property.
In the MsSql DataBase im using a Computed Column in one of my tables where a value is shown depending on some other values of the table. Now i want to get this column in the object instance of the entity - this works well so far. The problem is when i try to SaveUpdate the Object - because it is not possible to UpdateSave a computed column - so everytime i call SaveUpdate() method i get an exception - thats why i need something like a [ReadOnlyDbField] attribute for this property - thanks in advance!
I build my Fluent NHibertnate session like this.
Code:
if (ConfigurationManager.AppSettings[msSqlConnectionString] == null || ConfigurationManager.AppSettings[msSqlConnectionString] == String.Empty)
throw new NullReferenceException(String.Format("AppSetting '{0}' must not be null!", msSqlConnectionString));
nhibernateSession = Fluently.Configure().Database(MsSqlConfiguration.MsSql2005.ConnectionString(ConfigurationManager.AppSettings[msSqlConnectionString]))
.Mappings(m => m.AutoMappings.Add(AutoMap.Assembly(System.Reflection.Assembly.GetExecutingAssembly())
.Override<T_ABWEICHUNGEN>(map =>map.Map(d => d.A08_STATUS_FILE).Length(2147483647))
.IgnoreBase(typeof(BaseClass))
.IgnoreBase(typeof(IDColumn))
.IgnoreBase(typeof(MsSqlQuery))
.IgnoreBase(typeof(MsSqlParamCollection))
.IgnoreBase(typeof(AbweichungStatus))
)).BuildSessionFactory();