-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: [ReadOnlyDbField] custom attribute for property
PostPosted: Tue Mar 13, 2012 2:34 am 
Newbie

Joined: Tue Mar 13, 2012 2:33 am
Posts: 1
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();


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.