简体   繁体   English

为什么Fluent NHibernate生成的模式是只读的?

[英]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. 上面的代码成功创建了在其他地方定义的两个表,但是当我在SSMS中执行“编辑前200行”时,我发现单元格是只读的。

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. 我在Windows 7 Ultimate x86上使用VS 2010,.NET 4客户端固件,FluentNHibernate 2.0.3.0,NHibernate 4.0.0.4000,Iesi.Collections 4.0.0.4000。

The above code is from this book: NHibernate 3 Beginner's Guide [2011] 上面的代码来自于本书: NHibernate 3入门指南[2011]

I don't think this is related to NH or the fluent mappings. 我认为这与NH或流利的映射无关。 It sounds more like a SQL Server/SMSS issue. 听起来更像是SQL Server / SMSS问题。 Have you got enough privilege to alter the data? 您是否拥有足够的特权来更改数据?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM