如何将 POCO 与域服务类对话框一起使用?

发布于 2024-11-08 13:30:36 字数 1059 浏览 2 评论 0原文

我希望域服务类显示我的实体,以便我可以让它为我生成 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

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

征﹌骨岁月お 2024-11-15 13:30:36
  • 您是否更改了 tt 文件的自定义工具命名空间
    此外,您还必须编辑 .tt 文件并将行:string inputFile = @"$edmxInputFile$” 更改为例如 string inputFile = @"../DAL/Northwind。 edmx";
  • 有一个已报告的错误,现已修复,您可以在 地址。
  • 您必须安装您可以在此处找到它。
  • Have you changed the 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";.
  • There was a reported bug which is fxed now, you can find more info at this address.
  • You'd have to install the WCF RIA Services Toolkit. You can find it here.
差↓一点笑了 2024-11-15 13:30:36

^^ 将您的代码 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文