private void AddFieldsWithParameterToConstructor(ClassFile classFile, Mapper mapper) { foreach (var property in EntityHandler.GetClassBuilder(mapper.FromTo.From).GetChildChildCollectionProperties) { classFile.Constructor.AddFieldWithParameter(new Field("private", $"_{EntityHandler.GetMapperInterfaceParameter(property.Property.DataType.Type)}", EntityHandler.GetMapperInterface(property.Property.DataType.Type)), new TypeWithName($"{EntityHandler.GetMapperInterfaceParameter(property.Property.DataType.Type)}", EntityHandler.GetMapperInterface(property.Property.DataType.Type))); } }
private string GetMappingProperty(ClassProperty prop) { switch (prop.Property.DataType.Datatype) { case Datatype.Child: case Datatype.ReadonlyChild: return(prop.Property.Name + " = _" + EntityHandler.GetMapperInterfaceParameter(prop.Property.DataType.Type) + ".MapToObject(objectToMapFrom." + prop.Property.Name + ")"); case Datatype.ChildCollection: return(prop.Property.Name + ".Add(_" + EntityHandler.GetMapperInterfaceParameter(prop.Property.DataType.Type) + ".MapToObject(property));"); default: return(prop.Property.Name + " = objectToMapFrom." + prop.Property.Name); } }