I've been using c# for the past year and I enjoy the power you get with Fluent NHibernate. One question that I get from friends is "nice but how can vb.net programmers use this?"
So for example- the below is a c# mapping class. How would someone do this with vb.net?
public class PostMap : ClassMap<post>
{
public PostMap()
{
Table("Posts");
Id(x => x.ID);
Map(x => x.PublishDate, "PublishDate");
Map(x => x.Title, "Title");
Map(x => x.uri, "uri");
Map(x => x.Content, "Content");
HasMany(x => x.CommentCollection).KeyColumn("PostID");
HasManyToMany(x => x.TagCollection).Table("TagMap").ParentKeyColumn("PostID").ChildKeyColumn("TagID");
}
}
My fault - the above does translate
What about trying to create the fluent interface for config though?
private static ISessionFactory CreateSessionFactory()
{
var cfg = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005.ConnectionString(c => c.FromConnectionStringWithKey("Blog")))
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
.ExposeConfiguration(x => x.SetProperty("current_session_context_class", "web"));
return cfg.BuildSessionFactory();
}