private OdcmType ResolveType(string name, string @namespace, TypeKind kind) { OdcmType type; if (!_odcmModel.TryResolveType(name, @namespace, out type)) { switch (kind) { case TypeKind.Complex: type = new OdcmClass(name, @namespace, OdcmClassKind.Complex); break; case TypeKind.Entity: type = new OdcmClass(name, @namespace, OdcmClassKind.Entity); break; case TypeKind.Enum: type = new OdcmEnum(name, @namespace); break; case TypeKind.Primitive: type = new OdcmPrimitiveType(name, @namespace); break; } _odcmModel.AddType(type); } return(type); }
private static OdcmType PrimitiveOdcmType(Action <OdcmType> config = null) { var retVal = new OdcmPrimitiveType("String", "Edm"); if (config != null) { config(retVal); } return(retVal); }
private static OdcmType PrimitiveOdcmType(Action <OdcmType> config = null) { var retVal = new OdcmPrimitiveType("String", Vipr.Core.CodeModel.OdcmNamespace.Edm); if (config != null) { config(retVal); } return(retVal); }
public Given_an_OdcmClass_Entity_Fetcher_UpdateAsync_Method() { base.Init(m => { _structuralInstanceProperty = Any.PrimitiveOdcmProperty(p => { p.Class = Class; var type = new OdcmPrimitiveType("String", OdcmNamespace.Edm); p.Projection = type.DefaultProjection; }); Class.Properties.Add(_structuralInstanceProperty); }); }
private static OdcmPrimitiveType EnumUnderlyingType(Action <OdcmPrimitiveType> config = null) { List <string> underlyingTypes = new List <string>() { "Byte", "SByte", "Int16", "Int32", "Int64" }; var retVal = new OdcmPrimitiveType(underlyingTypes.RandomElement(), "Edm"); if (config != null) { config(retVal); } return(retVal); }
public static string GetPrimitiveTypeKeyword(OdcmPrimitiveType odcmType) { switch (odcmType.Name) { case "Byte": return("byte"); case "SByte": return("sbyte"); case "Int16": return("short"); case "UInt16": return("ushort"); case "Int32": return("int"); case "UInt32": return("uint"); case "Int64": return("long"); case "UInt64": return("ulong"); } return(null); }