
- 一对多
- 建立主表可读可写属性并使用Association特性进行关联
- [Association("采购订单明细")]
- [XafDisplayName("采购订单")]
- public PurchaseOrder PurchaseOrder
- {
- get { return _purchaseOrder;}
- set {SetPropertyValue(nameof(PurchaseOrder), ref _purchaseOrder, value);}
- }
- 建立从表
- [DevExpress.Xpo.Aggregated]//聚合型
- [Association("采购订单明细")]
- [XafDisplayName("采购订单")]
- public XPCollection<OrderDetails> OrderDetails
- {
- get { GetCollection<OrderDetails>("OrderDetails");}
- }
- 一对一
- 在角色与用户关联
- Userinfo user = null;
- public Userinfo User
- {
- get { return user; }
- set
- {
- if (user == value) return;
- Userinfo userinfo = user;
- User = value;
- if (IsLoading) return;
- if (userinfo != null && userinfo.Role == this)
- userinfo.Role = null;
- if (user != null)
- user.Role = this;
- OnChanged(nameof(Role));
- }
- }
- 在用户与角色关联
- Roleinfo role = null;
- public Roleinfo Role
- {
- get { return role; }
- set
- {
- if (role == value)return;
- Roleinfo roleinfo = role;
- role = value;
- if (IsLoading) return;
- if (roleinfo != null && roleinfo.User == this)
- roleinfo.User = null;
- if (role != null)
- role.User = this;
- OnChanged(nameof(Role));
- }
- }
- 多对多
- [Association("Userinfo")]
- public XPCollection<Userinfo> Userinfo
- {
- get { return GetCollection<Userinfo>(nameof(Userinfo)); }
- }
- [Association("Userinfo")]
- public XPCollection<Roleinfo> Roleinfo
- {
- get { return GetCollection<Roleinfo>(nameof(Roleinfo)); }
- }
评价
排名
11
文章
201
粉丝
10
评论
13
EF连接MySQL连接MySQL数据库操作中文数据乱码解决方法
剑轩 :
准确点应该是ef连接mysql
Layui插件上传图片具体步奏以及获取图片地址
风清月 : 厉害老!
Action与Func的用法-----委托
剑轩 : 可以可以
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256


欢迎加群交流技术
剑轩
嘿嘿嘿,来个图示会更香