Class definition:
public class worker
{
public virtual float Balance { get; set; } public virtual int? Age { get; set; } public virtual string Name { get; set; } public virtual Sex Sex { get; set; } public virtual string HomeAddress { get; set; } public virtual DateTime Birthday { get; set; } public virtual int Id { get;} public virtual byte[] Image { get; set; } public virtual string Region { get; set; } public virtual string City { get; set; }
}
Map(w => w.Region) .Column("WorkerRegion") .CustomSqlType("char(6)") .Not.Nullable().Index("WorkerRegion_Index"); Map(w => w.City,"WorkerCity") .CustomSqlType("nvarchar(26)") .Formula("WorkerRegion");
internal static class NhibernateHelper { private static readonly Lazy<ISessionFactory> SessionFactory=new Lazy<ISessionFactory>(GetSessionFactory,LazyThreadSafetyMode.ExecutionAndPublication); private const string ConnectionStringKey = "FNHDemo"; private static ISessionFactory GetSessionFactory() { var sessionFactory = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2012.ConnectionString(c => c.FromConnectionStringWithKey(ConnectionStringKey))) .Mappings(m => m.FluentMappings.AddFromAssembly(typeof(NhibernateHelper).Assembly)) .ExposeConfiguration(BuildSchema) .BuildSessionFactory(); return sessionFactory; } public static ISession GetSession() { return SessionFactory.Value.OpenSession(); } public static void BuildSchema(Configuration cfg) { new SchemaExport(cfg).Create(true, true); } }
I thought formula was to run arbitrary SQL. From the mapping provided I don't see any SQL statement.
--
You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluent-nhibern...@googlegroups.com.
To post to this group, send email to fluent-n...@googlegroups.com.
Visit this group at https://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Fluent NHibernate" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fluent-nhibernate/f-TwS310h5k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fluent-nhibern...@googlegroups.com.
To post to this group, send email to fluent-n...@googlegroups.com.
Visit this group at https://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.