public static OdcmClass EntityOdcmClass(OdcmNamespace odcmNamespace, Action <OdcmClass> config = null) { var retVal = new OdcmClass(Any.CSharpIdentifier(), odcmNamespace.Name, OdcmClassKind.Entity); retVal.Properties.AddRange(Any.Sequence(i => Any.PrimitiveOdcmProperty(p => p.Class = retVal))); retVal.Key.AddRange(retVal.Properties.RandomSubset(2).Select(p => p.Field)); if (odcmNamespace.Classes.Any(c => c.Kind == OdcmClassKind.Complex)) { retVal.Properties.AddRange(Any.Sequence(i => Any.OdcmProperty(p => { p.Class = retVal; p.Type = odcmNamespace.Classes.Where(c => c.Kind == OdcmClassKind.Complex).RandomElement(); }))); } if (config != null) { config(retVal); } retVal.Methods.AddRange(Any.Sequence(s => Any.OdcmMethod())); return(retVal); }
public static OdcmNamespace OdcmNamespace(Action <OdcmNamespace> config = null) { var retVal = new OdcmNamespace(Any.CSharpIdentifier()); retVal.Types.AddRange(Any.Sequence(s => Any.OdcmEnum())); retVal.Types.AddRange(Any.Sequence(s => Any.ComplexOdcmType(retVal))); var classes = Any.Sequence(s => Any.EntityOdcmClass(retVal)).ToArray(); foreach (var @class in classes) { @class.Properties.AddRange(Any.Sequence(i => Any.OdcmProperty(p => { p.Class = @class; p.Type = classes.RandomElement(); }))); } classes[0].Base = classes[1]; retVal.Types.AddRange(classes); if (config != null) { config(retVal); } return(retVal); }
public static OdcmServiceClass ServiceOdcmClass(OdcmNamespace odcmNamespace, Action <OdcmServiceClass> config = null) { var retVal = new OdcmServiceClass(Any.CSharpIdentifier(), odcmNamespace); var entities = odcmNamespace.Classes .Where(c => c.Kind == OdcmClassKind.Entity); foreach (var entity in entities) { retVal.Properties.Add(new OdcmProperty(entity.Name) { Class = retVal, Type = entity }); retVal.Properties.Add(new OdcmProperty(entity.Name + "s") { Class = retVal, Type = entity, IsCollection = true }); } retVal.Methods.AddRange(Any.Sequence(s => Any.OdcmMethod())); if (config != null) { config(retVal); } return(retVal); }
public static OdcmMediaClass MediaOdcmClass(OdcmNamespace odcmNamespace, Action <OdcmEntityClass> config = null) { var retVal = new OdcmMediaClass(Any.CSharpIdentifier(), odcmNamespace); EntityOrMediaOdcmClass(odcmNamespace, config, retVal); return(retVal); }
public static OdcmComplexClass OdcmComplexClass(Action <OdcmClass> config = null) { var retVal = new OdcmComplexClass(Any.CSharpIdentifier(), Any.OdcmNamespace()); if (config != null) { config(retVal); } return(retVal); }
public static OdcmField OdcmField(Action <OdcmField> config = null) { var retVal = new OdcmField(Any.CSharpIdentifier()); if (config != null) { config(retVal); } return(retVal); }
public static OdcmClass OdcmClass(Action <OdcmClass> config = null) { var retVal = new OdcmClass(Any.CSharpIdentifier(), Any.CSharpIdentifier(), OdcmClassKind.Complex); if (config != null) { config(retVal); } return(retVal); }
public static OdcmParameter OdcmParameter(Action <OdcmParameter> config = null) { var retVal = new OdcmParameter(Any.CSharpIdentifier()); if (config != null) { config(retVal); } return(retVal); }
public static OdcmProperty OdcmProperty(Action <OdcmProperty> config = null) { var retVal = new OdcmProperty(Any.CSharpIdentifier()); if (config != null) { config(retVal); } return(retVal); }
public static OdcmNamespace EmptyOdcmNamespace(Action <OdcmNamespace> config = null) { var retVal = new OdcmNamespace(Any.CSharpIdentifier()); if (config != null) { config(retVal); } return(retVal); }
public static OdcmEnum OdcmEnum(Action <OdcmEnum> config = null) { var retVal = new OdcmEnum(Any.CSharpIdentifier(), Any.CSharpIdentifier()); retVal.UnderlyingType = Any.EnumUnderlyingType(); if (config != null) { config(retVal); } return(retVal); }
private static OdcmClass ComplexOdcmType(OdcmNamespace odcmNamespace, Action <OdcmClass> config = null) { var retVal = new OdcmClass(Any.CSharpIdentifier(), odcmNamespace.Name, OdcmClassKind.Complex); retVal.Properties.AddRange(Any.Sequence(i => Any.PrimitiveOdcmProperty(p => p.Class = retVal))); if (config != null) { config(retVal); } return(retVal); }
public static OdcmField PrimitiveOdcmField(Action <OdcmField> config = null) { var retVal = new OdcmField(Any.CSharpIdentifier()) { Type = Any.PrimitiveOdcmType() }; if (config != null) { config(retVal); } return(retVal); }
public static OdcmProperty ComplexOdcmProperty(OdcmNamespace odcmNamespace, Action <OdcmProperty> config = null) { var retVal = new OdcmProperty(Any.CSharpIdentifier()) { Type = Any.ComplexOdcmType(odcmNamespace) }; if (config != null) { config(retVal); } return(retVal); }
public static object ComplexOdcmField(OdcmNamespace odcmNamespace, Action <OdcmField> config = null) { var retVal = new OdcmField(Any.CSharpIdentifier()) { Type = Any.ComplexOdcmType(odcmNamespace) }; if (config != null) { config(retVal); } return(retVal); }
public static OdcmProperty PrimitiveOdcmProperty(Action <OdcmProperty> config = null) { var retVal = new OdcmProperty(Any.CSharpIdentifier()) { Projection = Any.PrimitiveOdcmType().DefaultProjection }; if (config != null) { config(retVal); } return(retVal); }
private static OdcmProperty OdcmEntityProperty(OdcmClass @class, Action <OdcmProperty> config) { var retVal = new OdcmProperty(Any.CSharpIdentifier()) { Type = @class }; if (config != null) { config(retVal); } return(retVal); }
private static OdcmProperty OdcmEntityProperty(OdcmClass @class, Action <OdcmProperty> config) { var projection = @class.DefaultProjection; var retVal = new OdcmProperty(Any.CSharpIdentifier()) { Projection = projection }; if (config != null) { config(retVal); } return(retVal); }
public static OdcmProperty ComplexOdcmProperty(OdcmNamespace odcmNamespace, Action <OdcmProperty> config = null) { var projection = Any.ComplexOdcmClass(odcmNamespace).DefaultProjection; var retVal = new OdcmProperty(Any.CSharpIdentifier()) { Projection = projection }; if (config != null) { config(retVal); } return(retVal); }
public static OdcmMethod OdcmMethod(Action <OdcmMethod> config = null) { var retVal = new OdcmMethod(Any.CSharpIdentifier()); retVal.Parameters.AddRange( Any.Sequence(s => new OdcmParameter(Any.CSharpIdentifier()) { Type = Any.PrimitiveOdcmType() }, Any.Int(0, 3))); if (config != null) { config(retVal); } return(retVal); }
public static OdcmNamespace OdcmNamespace(Action <OdcmNamespace> config = null) { var retVal = new OdcmNamespace(Any.CSharpIdentifier()); retVal.Types.AddRange(Any.Sequence(s => Any.OdcmEnum())); retVal.Types.AddRange(Any.Sequence(s => Any.ComplexOdcmClass(retVal))); var classes = Any.Sequence(s => Any.OdcmEntityClass(retVal)) .Concat(Any.Sequence(s => Any.MediaOdcmClass(retVal), count: 2)).ToArray(); foreach (var @class in (from @class in retVal.Types where @class is OdcmEntityClass select @class as OdcmEntityClass)) { @class.Properties.AddRange(Any.Sequence(i => Any.OdcmProperty(p => { p.Class = @class; p.Type = classes.RandomElement(); }))); } foreach (var @class in classes) { @class.Properties.AddRange(Any.Sequence(i => Any.OdcmProperty(p => { p.Class = @class; p.Type = classes.RandomElement(); }))); } classes[0].Base = classes[1]; if (!classes[1].Derived.Contains(classes[0])) { classes[1].Derived.Add(classes[0]); } retVal.Types.AddRange(classes); if (config != null) { config(retVal); } return(retVal); }
public static OdcmProperty EntityOdcmProperty(OdcmNamespace odcmNamespace, Action <OdcmProperty> config = null) { var retVal = new OdcmProperty(Any.CSharpIdentifier()) { Type = Any.EntityOdcmClass(odcmNamespace) }; retVal.Field = new OdcmField(Any.CSharpIdentifier()) { Type = retVal.Type }; if (config != null) { config(retVal); } return(retVal); }
public static OdcmMethod OdcmMethodGet(Action <OdcmMethod> config = null) { var retVal = new OdcmMethod(Any.CSharpIdentifier(), Any.EmptyOdcmNamespace()); retVal.Verbs = OdcmAllowedVerbs.Get; retVal.Parameters.AddRange( Any.Sequence( s => new OdcmParameter(Any.CSharpIdentifier()) { Type = Any.PrimitiveOdcmType(), CallingConvention = OdcmCallingConvention.InHttpRequestUri }, Any.Int(1, 3))); if (config != null) { config(retVal); } return(retVal); }
public static OdcmMethod OdcmMethodPost(Action <OdcmMethod> config = null) { var retVal = Any.OdcmMethodGet(); retVal.Verbs = OdcmAllowedVerbs.Post; retVal.Parameters.AddRange( Any.Sequence( s => new OdcmParameter(Any.CSharpIdentifier()) { Type = Any.PrimitiveOdcmType(), CallingConvention = OdcmCallingConvention.InHttpMessageBody }, Any.Int(1, 3))); if (config != null) { config(retVal); } return(retVal); }
public static OdcmEntityClass OdcmEntityClass(OdcmNamespace odcmNamespace, Action <OdcmEntityClass> config = null) { return(Any.OdcmEntityClass(odcmNamespace, Any.CSharpIdentifier(), config)); }