コード例 #1
0
            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);
            }
コード例 #2
0
        private static OdcmType PrimitiveOdcmType(Action <OdcmType> config = null)
        {
            var retVal = new OdcmPrimitiveType("String", "Edm");

            if (config != null)
            {
                config(retVal);
            }

            return(retVal);
        }
コード例 #3
0
ファイル: Any.Odcm.cs プロジェクト: tonycrider/Vipr
        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);
        }
コード例 #4
0
 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);
     });
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }