public static ConstructorList Create(string name, IEnumerable <EntityProperty> properties, List <Constructor> constructed = null, IEnumerable <EntityConstructorProperty> derivedProperties = null, ArgumentList arguments = null) { if (!Any(constructed)) { return(Create(name, properties, new List <Constructor> { Default(name), BaseCase(name, properties) })); } if (arguments != null) { constructed.Add(Linked(name, properties, arguments)); } var specialCases = properties.Where(p => p.SpecialType != null); if (Any(specialCases)) { var derived = PropertyDerivatives(properties); return(Create(name, derived.Select(d => d.PropertyDerivative), constructed, derived, List(derivedProperties))); } return(ConstructorLists.Create(constructed.ToArray())); }
public Code GetCode() => Class("MyProject", "My project description", "1.0.0", null, "MyTypeName", usingDirectiveList: UsingDirectiveLists.Create("System", "System.IO"), documentationCommentList: Comments.Summary("This is the class XML-doc summary comment"), attributeListCollection: AttributeLists.Create(Attributes.ProtoContract()), constructorList: ConstructorLists.Create(Constructors.Default("MyTypeName")), methodList: MethodLists.Create(Methods.PublicStatic("GetInt", "int", "5 + 5")), propertyList: PropertyLists.Create(Properties.Public("MyProperty", "string", "This is the property XML-doc summary comment", AttributeLists.Create(Attributes.ProtoMember(1)))));
private static ConstructorList GetConstructorList(string typeName) => ConstructorLists.Create( DbContextConstructors.Create(typeName));