如何在 Fluent Nhibernate 中使用组件
我正在开发一个旧版 MySql 数据库,并拥有以下实体:
public class Company
{
public int Id { get; set;}
public string Address { get; set; }
public string City { get; set; }
}
public class CompanyDepartment
{
public int Id { get; set;}
public string Address { get; set; }
public string City { get; set; }
}
这个想法是,一家公司仅在拥有多个部门时才使用部门类。
现在我正在尝试进行公司/部门搜索,这意味着我需要一份所有部门的列表,因此我需要“创建”所有只有一个部门的公司的部门,因此没有条目在公司部门。
为此,我正在考虑使用流畅的 NHibernate 中的组件,但我不确定我是否可以将真实的部门与假的部门结合起来?
有没有更好的方法来解决这个问题?这不是更改数据库结构的选项。
I'm working on a legacy MySql database and have the following entities:
public class Company
{
public int Id { get; set;}
public string Address { get; set; }
public string City { get; set; }
}
public class CompanyDepartment
{
public int Id { get; set;}
public string Address { get; set; }
public string City { get; set; }
}
The idea is that a company only use the department class if it has more than one department.
Right now I'm trying to make a company/department search, this means I need a list of all departments and therefore I need to "create" departments of all the companies that only has one department, and therefore don't have a entry in CompaynyDepartment.
To do this I was thinking of use components in fluent NHibernate, but I'm not sure I can join the real departments with the fake ones?
Is there a better approach to this problem? It's not an option to change the database structure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终改变了数据库结构
I ended up changing the database structure