internal EmployeeImpl( Key id, Timestamp timestamp, params DictionaryEntry[] parameters) { markClean(); m_id = id; m_timestamp = timestamp; FieldInfo fInfo; Type thisType = this.GetType(); Type domainObjectType = typeof(Employee); IEnumerator enumerator = parameters.GetEnumerator(); while(enumerator.MoveNext()) { if(((DictionaryEntry)enumerator.Current).Value != null) { if(((DictionaryEntry)enumerator.Current).Value.GetType() == typeof(ToOneRelation)) { if((String)((DictionaryEntry)enumerator.Current).Key == "ReportsTo") { m_ReportsTo = (ToOneRelation)((DictionaryEntry)enumerator.Current).Value; continue; } } if(((DictionaryEntry)enumerator.Current).Value.GetType() == typeof(ToManyRelation)) { if((String)((DictionaryEntry)enumerator.Current).Key == "ReportedBy") { m_ReportedBy = (ToManyRelation)((DictionaryEntry)enumerator.Current).Value; continue; } if((String)((DictionaryEntry)enumerator.Current).Key == "EmployeeTerritories") { m_EmployeeTerritories = (ToManyRelation)((DictionaryEntry)enumerator.Current).Value; continue; } } } if(this.GetType().GetProperty((String)((DictionaryEntry)enumerator.Current).Key) != null) { string variable = "m_" + (String)((DictionaryEntry)enumerator.Current).Key; if((fInfo = thisType.GetField(variable, BindingFlags.DeclaredOnly|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance)) != null) { fInfo.SetValue(this, ((DictionaryEntry)enumerator.Current).Value); } } } }
public DomainObject createFromParameters( Key id, Timestamp timestamp, params DictionaryEntry[] parameters) { return new EmployeeImpl(id, timestamp, parameters); }