public DomainObjectInitializer(ICoreContext ctx, IConstructor constructor) { this.ctx = ctx; groups = new List <DomainParameter.Group <IConstructor> >(); Parameter = new Dictionary <string, DomainParameter>(); Marks = new Marks(); AddGroup(constructor); }
private DomainParameter(ICoreContext ctx, IParameter parameter, int initialGroupIndex) { this.ctx = ctx; this.parameter = parameter; Name = ctx.CodingStyle.GetName(parameter); ParameterType = ctx.GetDomainType(Fix(parameter.ParameterType)); Marks = new Marks(ctx.CodingStyle.GetMarks(parameter)); Groups = new List <int> { initialGroupIndex }; IsList = parameter.ParameterType.CanBeCollection(); IsOptional = ctx.CodingStyle.IsOptional(parameter); defaultValue = ctx.CodingStyle.GetDefaultValue(parameter); }
public void AddGroup(IMethod method) { if (groups.Any() && !method.ReturnType.Equals(groups.Last().Parametric.ReturnType)) { throw new ReturnTypesDoNotMatchException(method, groups.Last().Parametric.ReturnType, method.ReturnType); } if (groups.Any(g => g.ContainsSameParameters(method))) { throw new IdenticalSignatureAlreadyAddedException(method); } DomainParameter.AddGroupToTarget(method, this); Marks.Join(ctx.CodingStyle.GetMarks(method)); }
public DomainType(ICoreContext ctx, IType type) { this.ctx = ctx; Type = type; Data = new Dictionary <string, DomainData>(); Operation = new Dictionary <string, DomainOperation>(); Marks = new Marks(ctx.CodingStyle.GetMarks(Type)); Name = ctx.CodingStyle.GetName(Type); Module = ctx.CodingStyle.GetModule(Type); Id = ctx.BuildTypeId(Module, Name); MaxFetchDepth = ctx.CodingStyle.GetMaxFetchDepth(); locator = ctx.CodingStyle.GetLocator(Type); IdExtractor = ctx.CodingStyle.GetIdExtractor(Type); ValueExtractor = ctx.CodingStyle.GetValueExtractor(Type); converter = new Dictionary <IType, IConverter>(); var converters = ctx.CodingStyle.GetConverters(Type); foreach (var converterInstance in converters) { foreach (var targetType in converterInstance.GetTargetTypes(Type)) { if (converter.ContainsKey(targetType)) { continue; } converter.Add(targetType, converterInstance); } } staticInstances = ctx.CodingStyle.GetStaticInstances(Type); IsValueModel = ctx.CodingStyle.IsValue(Type); IsViewModel = ctx.CodingStyle.IsView(Type); actualTypes = new List <DomainType>(); viewTypes = new List <DomainType>(); }
public DomainData(ICoreContext ctx, IProperty property) { this.ctx = ctx; this.property = property; Name = ctx.CodingStyle.GetName(property); Marks = new Marks(ctx.CodingStyle.GetMarks(property)); IsList = property.ReturnType.CanBeCollection(); FetchedEagerly = ctx.CodingStyle.IsFetchedEagerly(property); var returnType = IsList ? property.ReturnType.GetItemType() : property.ReturnType; if (!ctx.CodingStyle.ContainsType(returnType)) { throw new TypeNotConfiguredException(returnType); } DataType = ctx.GetDomainType(returnType); }
public DomainOperation(ICoreContext ctx, IMethod method) { this.ctx = ctx; groups = new List <DomainParameter.Group <IMethod> >(); Name = ctx.CodingStyle.GetName(method); Marks = new Marks(); ResultIsVoid = method.ReturnType.IsVoid; ResultIsList = method.ReturnType.CanBeCollection(); Parameter = new Dictionary <string, DomainParameter>(); var returnType = ResultIsList ? method.ReturnType.GetItemType() : method.ReturnType; if (!ctx.CodingStyle.ContainsType(returnType)) { throw new TypeNotConfiguredException(returnType); } ResultType = ctx.GetDomainType(returnType); AddGroup(method); }
public bool MarkedAs(string mark) => Marks.Has(mark);
private void AddGroup(IParameter parameter, int groupIndex) { Groups.Add(groupIndex); Marks.Join(ctx.CodingStyle.GetMarks(parameter)); }