public void SetupStartMethod(Reflection.Emit.Interfaces.IMethodBuilder Method, Type BaseType) { Method.SetCurrentMethod(); if (ClassMappings.ContainsKey(BaseType) && Method.Name.StartsWith("set_", StringComparison.InvariantCulture)) { foreach (IMapping Mapping in ClassMappings[BaseType]) { string PropertyName = Method.Name.Replace("set_", ""); IProperty Property = Mapping.Properties.FirstOrDefault(x => x.Name == PropertyName); if (Property != null) { Company.Utilities.Reflection.Emit.FieldBuilder Field = Fields.Find(x => x.Name == Property.DerivedFieldName); if (Field != null) Field.Assign(Method.Parameters.ElementAt(1)); return; } } } }
public void SetupEndMethod(Reflection.Emit.Interfaces.IMethodBuilder Method, Type BaseType, Reflection.Emit.BaseClasses.VariableBase ReturnValue) { Method.SetCurrentMethod(); if (ClassMappings.ContainsKey(BaseType) && Method.Name.StartsWith("get_", StringComparison.InvariantCulture)) { foreach (IMapping Mapping in ClassMappings[BaseType]) { string PropertyName = Method.Name.Replace("get_", ""); IProperty Property = Mapping.Properties.FirstOrDefault(x => x.Name == PropertyName); if (Property != null) { if (Property is IManyToOne || Property is IMap) SetupSingleProperty(Method, BaseType, ReturnValue, Property, Mapping); else if (Property is IIEnumerableManyToOne || Property is IManyToMany) SetupIEnumerableProperty(Method, BaseType, ReturnValue, Property, Mapping); else if (Property is IListManyToMany || Property is IListManyToOne) SetupListProperty(Method, BaseType, ReturnValue, Property, Mapping); return; } } } }