By default, properties without a state (a field) are not persisted. If you need a persistent read-only property (a sort of denormalization) you have to explicitly declare it:
orm.PersistentProperty<YourEntity>(ye => ye.YourReadOnly); On Thu, Jan 20, 2011 at 9:49 AM, Paulo Quicoli <[email protected]>wrote: > Hi Friends! > > I'm facing something really weird. I did mapping of my classes, and ok, > that worked out. Now I just included a new property - a read only one- in > one class, but when I run my test, that new property is not created in my > database! Also, in this same class I included a component class, but again > it doesnt get mapped. conORM is always generating mapping in way before I > had made changes. I'm showing some piece of my code: > > First, my read only property: > > public string PhoneticName > { > get > > { > return Name != null ? Fonetico.Fonetiza(Name) : null; > > } > } > > > Now my mapping routine: > > var orm = new ObjectRelationalMapper(); > > > var patternsAppliers = new SafePropertyAccessorPack(); > patternsAppliers.Merge(new IdNamingApplier()); > > patternsAppliers.Merge(new CoolPatternsAppliersHolder(orm)); > patternsAppliers.Merge(new OneToManyKeyColumnNamingApplier(orm)); > > patternsAppliers.Merge(new ManyToOneColumnNamingApplier()); > > > var mapper = new Mapper(orm, patternsAppliers); > > IEnumerable<Type> baseEntities = > typeof(Profissao).Assembly.GetTypes().Where(t => t.Namespace == > typeof(Profissao).Namespace); > > orm.Patterns.Lists.Remove(orm.Patterns.Lists.Single(p => > p.GetType() == typeof(ListCollectionPattern))); > > orm.Patterns.PoidStrategies.Add(new HighLowPoidPattern(new { > max_lo = 100 })); > > orm.TablePerClass(baseEntities); > > mapper.Class<Person>(c => > { > c.Property(p => p.Name, pm => pm.Length(100)); > > c.Property(p=> p.PhoneticName, pm => > pm.Access(Accessor.ReadOnly)); > c.Component(p => p.Photo, cm => cm.Property(f => f.Path, fm > => fm.Length(255))); > > }); > > HbmMapping mappingDocument = > mapper.CompileMappingFor(baseEntities); > nhConfig.AddDeserializedMapping(mappingDocument, "Domain"); > > > > > -- > Paulo Quicoli > Editor Técnico: .NET Magazine, ClubeDelphi Magazine, WebMobile Magazine > www.devmedia.com.br > www.nhibernatebrasil.net > http://pauloquicoli.spaces.live.com > twitter:@pauloquicoli > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- Fabio Maulo -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
