关于c#partial class accesibility [英] About c# partial class accesibility

查看:134
本文介绍了关于c#partial class accesibility的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于c#

I have a question about partial classes in c#

在这张图片中,我有一个域模型。我已经将此(DomainModelLib)添加到客户端应用程序和repoistory应用程序。

In This picture, I have a domain model. I am have added reference this(DomainModelLib) to Client application and repoistory application.

存储库应用程序正在使用此域模型类作为DbSet并从数据库获取数据。我们引用模型到客户端应用程序的模型,在模型部分类中创建了实例。

Repository application is using this domain model classes as "DbSet" and getting data from database. Realtions are created in model partial classes as you can see.

我想要的第一部分(第一个红色框架)的产品类可以访问客户端应用程序,但第二部分(底部红色框架)的类无法访问。

I referenced Model to Client application. I wanna first partial(first red frame) of Product class can access in Client application but second part(bottom red frame) of class can not access.

但两个部分应该可以在存储库中访问。这是可能的吗?

But two parts should be accesible in repository. Is this possible?

(NHibernate XML映射是保持与用户的关系,我在实体框架中保持用户的这种方式)

(NHibernate XML mapping is keeping relations from users, I wana keep somethings from users this way in Entity Framework)

推荐答案

可以创建一个新的库(说X)。将底部的红色框架移动到该框架中。从域和回购引用X。

A new library could be created (say X). Move the bottom red frame into that. Reference X from both domain and repo.

这篇关于关于c#partial class accesibility的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆