Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Relation<T>
- {
- private T _value;
- private void FetchData()
- {
- if( LoadData != null ) {
- LoadDataEventArgs args = new LoadDataEventArgs(typeof(T), /* magic to get correct object */);
- LoadData(this, args);
- _value = (T)args.Value;
- }
- }
- public event EventHandler<LoadDataEventArgs> LoadData;
- public T Value {
- get {
- if( _value == default(T) )
- FetchData();
- return _value;
- }
- set { /* Do magic here. */ }
- }
- }
- [RelationCriteria("ID", EqualsMyProperty="AddressID")]
- public Relation<Address> Address {
- get; set;
- }
Add Comment
Please, Sign In to add comment