如何将 POCO 与域服务类对话框一起使用?
我希望域服务类显示我的实体,以便我可以让它为我生成 CRUD。为什么没有显示任何内容?
项目结构:
EF模型位于类库中 POCO (.tt) 位于另一个类库
现在我已经手动创建了 CRUD 操作,但我想要对话框来创建它们。
@Akash Kava:这是其中一个 pocos 的主键:
[DataMember]
public int CVAdvancementQuotientId
{
get { return _cVAdvancementQuotientId; }
set
{
if (_cVAdvancementQuotientId != value)
{
if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
{
throw new InvalidOperationException("The property 'CVAdvancementQuotientId' is part of the object's key and cannot be changed. Changes to key properties can only be made when the object is not being tracked or is in the Added state.");
}
_cVAdvancementQuotientId = value;
OnPropertyChanged("CVAdvancementQuotientId");
}
}
}
private int _cVAdvancementQuotientId;
I want the Domain Service Class to show my entities so that I can have it generate CRUD for me. Why is nothing showing up?
Project structure:
EF model sits in class library and
POCO (.tt) sits in another class library
For now I have manually created the CRUD operations, but I want the dialog to create them.
@Akash Kava: Here is a primary key for one of the pocos:
[DataMember]
public int CVAdvancementQuotientId
{
get { return _cVAdvancementQuotientId; }
set
{
if (_cVAdvancementQuotientId != value)
{
if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
{
throw new InvalidOperationException("The property 'CVAdvancementQuotientId' is part of the object's key and cannot be changed. Changes to key properties can only be made when the object is not being tracked or is in the Added state.");
}
_cVAdvancementQuotientId = value;
OnPropertyChanged("CVAdvancementQuotientId");
}
}
}
private int _cVAdvancementQuotientId;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
自定义工具命名空间
?此外,您还必须编辑 .tt 文件并将行:
string inputFile = @"$edmxInputFile$”
更改为例如string inputFile = @"../DAL/Northwind。 edmx";
。Custom Tool Namespace
for the tt file?Also, you'd have to edit the .tt file and chenge the line:
string inputFile = @"$edmxInputFile$”
to e.g.string inputFile = @"../DAL/Northwind.edmx";
.^^ 将您的代码 CodeGenerationStrategy 设置为 Default 而不是 none >从 EF 模型中删除 .tt 文件>>重建>>实体将会出现
^^ Make your code CodeGenerationStrategy as Default rather than none > delete .tt files from your EF model >> Rebuild >> Entities will show up