Search code examples
c#nhibernatefluent-nhibernateiesi-collections

Why is the schema generated by Fluent NHibernate read-only?


I have the following code:

var schemaExport = new SchemaExport(cfg);
schemaExport.Drop(false, true);
schemaExport.Create(false, true);

Fluently.Configure()
  .Database(MsSqlConfiguration
  .MsSql2008
  .ConnectionString(connString))
  .Mappings(m => m.FluentMappings.AddFromAssemblyOf<ProductMap>())
  .ExposeConfiguration(CreateSchema)
  .BuildConfiguration();

The above code successfully creates the two tables defined elsewhere, but when I do "Edit top 200 rows" in SSMS, I find that the cells are read-only.

There is no obvious mention of any read-only directive in the code files, mappings, or anywhere else.

Why is the schema generated as read-only?

I am using VS 2010, .NET 4 Client FW, FluentNHibernate 2.0.3.0, NHibernate 4.0.0.4000, Iesi.Collections 4.0.0.4000, on Windows 7 Ultimate x86.

The above code is from this book: NHibernate 3 Beginner's Guide [2011]


Solution

  • I don't think this is related to NH or the fluent mappings. It sounds more like a SQL Server/SMSS issue. Have you got enough privilege to alter the data?