Ria服务生成的代码不支持部分类

发布于 2024-09-10 22:24:23 字数 752 浏览 0 评论 0原文

我正在使用 Ria 服务类库。其中包含 2 个名为 RiaClasslibrary RiaClasslibrary.Web 的库。

Riaclasslibrary.Web 包含 ADO.NET 实体数据模型 并命名为 BaseModelBaseModel包含tPage类。

我的问题是

我正在插入单独的 tPage 类。该类包含 2 个公共属性。如下所示

public sealed partial class tPage : EntityObject
{        
    public List<tPage> Children { get; set; }
    public tPage Parent { get; set; }
    public Boolean IsSelected { get; set; }
}

,在我插入 DomainService 并构建 RiaClasslibrary.Web 类库之后。但 ria 服务生成的代码不包含上述属性。

你有一个问题。为什么要分离 tPage 类。您只需将这 3 个属性插入到 Modelbase.Designer 代码中即可。
我的答案是:数据库不包含这 3 个属性,如果我在代码中插入属性,则更新实体模型后属性将被删除。

I'm using Ria service class library. This contains 2 library named RiaClasslibrary RiaClasslibrary.Web.

Riaclasslibrary.Web contains ADO.NET entity data model and named BaseModel. BaseModelcontains tPage class.

My problem is

I'm inserting separated tPage class. This class contains 2 public property. show below

public sealed partial class tPage : EntityObject
{        
    public List<tPage> Children { get; set; }
    public tPage Parent { get; set; }
    public Boolean IsSelected { get; set; }
}

After I'm inserting DomainService and building RiaClasslibrary.Web class library. But ria service generated code doesn't contains above properties.

You have a question. Why you separate tPage class. You simply insert those 3 property in Modelbase.Designer code.
My answer is: Database doesn't contain those 3 property and If I'm inserting properties in the code, properties removed after updating Entity Model.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

那片花海 2024-09-17 22:24:23

@ebattulga

我不知道你是否仍然有这个问题,但我会发布答案,因为我遇到了类似的问题。

答案为

插入 DomainService 后
构建RiaClasslibrary.Web类
图书馆。但是ria服务生成了
代码不包含以上内容
属性。

很容易但很难找到。

您可以在“共享代码”部分中阅读 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-5-Metadata-and-Shared-Classes.aspx

如果您想查看部分类的自定义属性对于客户端,您必须将类文件名从 MyClass.cs 重命名为 MyClass.shared.cs。这将在生成的客户端代码中创建部分类。

HTH

丹尼尔·斯科伦斯基

@ebattulga

I don't know if you still have this issue, but I will post the answer because I came to similar issue.

The answer for

After I'm inserting DomainService and
building RiaClasslibrary.Web class
library. But ria service generated
code doesn't contains above
properties.

is quite easy but hard to find.

You can read here in section "Shared Code" http://www.silverlightshow.net/items/WCF-RIA-Services-Part-5-Metadata-and-Shared-Classes.aspx

If you want to see custom properties from partial classes on the Client you have to rename class file name from MyClass.cs to simply MyClass.shared.cs. This will create partial class in the code generated Client side.

HTH

Daniel Skowroński

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