This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DomainObject1.cs
49 lines (46 loc) · 1.71 KB
/
DomainObject1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using DevExpress.Xpo;
using DevExpress.ExpressApp;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;
using System.ComponentModel;
using DevExpress.Data.Filtering;
namespace WinSolution.Module {
[DefaultClassOptions]
public class DomainObject1 : BaseObject {
public DomainObject1(Session session) : base(session) { }
private string _name;
public string Name {
get { return _name; }
set { SetPropertyValue("Name", ref _name, value); }
}
private MyRole _myRole;
[ImmediatePostData]
public MyRole MyRole {
get { return _myRole; }
set { SetPropertyValue("MyRole", ref _myRole, value); }
}
private MyUser _myUser;
[DataSourceProperty("MyUserDataSource")]
//[DataSourceCriteria("MyRoles[RoleName = 'r2']")]
public MyUser MyUser {
get { return _myUser; }
set { SetPropertyValue("MyUser", ref _myUser, value); }
}
private XPCollection<MyUser> myUserDataSourceInternal = null;
[Browsable(false), MemberDesignTimeVisibility(false)]
public XPCollection<MyUser> MyUserDataSource {
get {
if (myUserDataSourceInternal == null) {
myUserDataSourceInternal = new XPCollection<MyUser>(Session);
}
UpdateAddressDataSource();
return myUserDataSourceInternal;
}
}
private void UpdateAddressDataSource() {
myUserDataSourceInternal.Criteria = MyRole != null ? CriteriaOperator.Parse("MyRoles[RoleName = ?]", MyRole.RoleName) : null;
}
}
}