Exemplo n.º 1
0
        public static ITypeMapping Initialize(this ITypeMapping typeMapping)
        {
            typeMapping.Add(OpenApiLanguage.Instance, "array", CsharpLanguage.Instance, "List", nameSpace: "System.Collections.Generic", fromSystem: true);
            typeMapping.Add(OpenApiLanguage.Instance, "string", CsharpLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(OpenApiLanguage.Instance, "boolean", CsharpLanguage.Instance, "bool", true, fromSystem: true);
            typeMapping.Add(OpenApiLanguage.Instance, "integer", CsharpLanguage.Instance, "int", true, fromSystem: true);
            typeMapping.Add(OpenApiLanguage.Instance, "number", CsharpLanguage.Instance, "double", true, fromSystem: true);

            typeMapping.Add(OpenApiLanguage.Instance, "array", TypeScriptLanguage.Instance, "Array", fromSystem: true);
            typeMapping.Add(OpenApiLanguage.Instance, "string", TypeScriptLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(OpenApiLanguage.Instance, "boolean", TypeScriptLanguage.Instance, "boolean", true, fromSystem: true);
            typeMapping.Add(OpenApiLanguage.Instance, "integer", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(OpenApiLanguage.Instance, "number", TypeScriptLanguage.Instance, "number", true, fromSystem: true);

            return(typeMapping);
        }
        public static ITypeMapping Initialize(this ITypeMapping typeMapping)
        {
            typeMapping.Add(TsqlLanguage.Instance, "smallint", CsharpLanguage.Instance, "short", true);
            typeMapping.Add(TsqlLanguage.Instance, "bigint", CsharpLanguage.Instance, "long", true);
            typeMapping.Add(TsqlLanguage.Instance, "bit", CsharpLanguage.Instance, "bool", true);
            typeMapping.Add(TsqlLanguage.Instance, "int", CsharpLanguage.Instance, "int", true);
            typeMapping.Add(TsqlLanguage.Instance, "date", CsharpLanguage.Instance, "DateTime", true, "System");
            typeMapping.Add(TsqlLanguage.Instance, "datetime", CsharpLanguage.Instance, "DateTime", true, "System");
            typeMapping.Add(TsqlLanguage.Instance, "datetime2", CsharpLanguage.Instance, "DateTime", true, "System");
            typeMapping.Add(TsqlLanguage.Instance, "decimal", CsharpLanguage.Instance, "decimal", true);
            typeMapping.Add(TsqlLanguage.Instance, "nchar", CsharpLanguage.Instance, "string");
            typeMapping.Add(TsqlLanguage.Instance, "nvarchar", CsharpLanguage.Instance, "string");
            typeMapping.Add(TsqlLanguage.Instance, "char", CsharpLanguage.Instance, "string");
            typeMapping.Add(TsqlLanguage.Instance, "varchar", CsharpLanguage.Instance, "string");
            typeMapping.Add(TsqlLanguage.Instance, "varbinary", CsharpLanguage.Instance, "byte[]");
            typeMapping.Add(TsqlLanguage.Instance, "timestamp", CsharpLanguage.Instance, "byte[]");
            typeMapping.Add(TsqlLanguage.Instance, "uniqueidentifier", CsharpLanguage.Instance, "Guid", false, "System");
            typeMapping.Add(TsqlLanguage.Instance, "float", CsharpLanguage.Instance, "double", true);

            typeMapping.Add(TsqlLanguage.Instance, "smallint", TypeScriptLanguage.Instance, "number", true);
            typeMapping.Add(TsqlLanguage.Instance, "bigint", TypeScriptLanguage.Instance, "number", true);
            typeMapping.Add(TsqlLanguage.Instance, "bit", TypeScriptLanguage.Instance, "boolean", true);
            typeMapping.Add(TsqlLanguage.Instance, "int", TypeScriptLanguage.Instance, "number", true);
            typeMapping.Add(TsqlLanguage.Instance, "date", TypeScriptLanguage.Instance, "Date", true);
            typeMapping.Add(TsqlLanguage.Instance, "datetime", TypeScriptLanguage.Instance, "Date", true);
            typeMapping.Add(TsqlLanguage.Instance, "datetime2", TypeScriptLanguage.Instance, "Date", true);
            typeMapping.Add(TsqlLanguage.Instance, "decimal", TypeScriptLanguage.Instance, "number", true);
            typeMapping.Add(TsqlLanguage.Instance, "nchar", TypeScriptLanguage.Instance, "string", true);
            typeMapping.Add(TsqlLanguage.Instance, "nvarchar", TypeScriptLanguage.Instance, "string", true);
            typeMapping.Add(TsqlLanguage.Instance, "char", TypeScriptLanguage.Instance, "string", true);
            typeMapping.Add(TsqlLanguage.Instance, "varchar", TypeScriptLanguage.Instance, "string", true);
            typeMapping.Add(TsqlLanguage.Instance, "varbinary", TypeScriptLanguage.Instance, "number[]", true);
            typeMapping.Add(TsqlLanguage.Instance, "timestamp", TypeScriptLanguage.Instance, "number[]", true);
            typeMapping.Add(TsqlLanguage.Instance, "uniqueidentifier", TypeScriptLanguage.Instance, "string", true);
            typeMapping.Add(TsqlLanguage.Instance, "float", TypeScriptLanguage.Instance, "number", true);
            return(typeMapping);
        }
Exemplo n.º 3
0
        public static ITypeMapping Initialize(this ITypeMapping typeMapping)
        {
            typeMapping.Add(ReflectionLanguage.Instance, "System.Array", CsharpLanguage.Instance, "Array", nameSpace: "System", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Boolean", CsharpLanguage.Instance, "bool", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Byte", CsharpLanguage.Instance, "byte", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Char", CsharpLanguage.Instance, "char", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.DateTime", CsharpLanguage.Instance, "DateTime", nameSpace: "System", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Decimal", CsharpLanguage.Instance, "decimal", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Double", CsharpLanguage.Instance, "double", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Guid", CsharpLanguage.Instance, "Guid", nameSpace: "System", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Int16", CsharpLanguage.Instance, "short", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Int32", CsharpLanguage.Instance, "int", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Int64", CsharpLanguage.Instance, "long", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Object", CsharpLanguage.Instance, "unknown", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Single", CsharpLanguage.Instance, "float", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.String", CsharpLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.TimeSpan", CsharpLanguage.Instance, "TimeSpan", nameSpace: "System", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.UInt16", CsharpLanguage.Instance, "ushort", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.UInt32", CsharpLanguage.Instance, "uint", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.UInt64", CsharpLanguage.Instance, "ulong", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Void", CsharpLanguage.Instance, "void", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Array", CsharpLanguage.Instance, "Array", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Collections.Generic.IList", CsharpLanguage.Instance, "IList", nameSpace: "System.Collections.Generic", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Collections.Generic.List", CsharpLanguage.Instance, "List", nameSpace: "System.Collections.Generic", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Collections.Generic.IEnumerable", CsharpLanguage.Instance, "IEnumerable", nameSpace: "System.Collections.Generic", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Collections.Generic.Dictionary", CsharpLanguage.Instance, "Dictionary", nameSpace: "System.Collections.Generic", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Nullable", CsharpLanguage.Instance, "Nullable", nameSpace: "System", fromSystem: true);

            typeMapping.Add(ReflectionLanguage.Instance, "System.Array", TypeScriptLanguage.Instance, "Array", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Boolean", TypeScriptLanguage.Instance, "boolean", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Byte", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Char", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.DateTime", TypeScriptLanguage.Instance, "Date", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Decimal", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Double", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Guid", TypeScriptLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Int16", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Int32", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Int64", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Object", TypeScriptLanguage.Instance, "unknown", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Single", TypeScriptLanguage.Instance, "number", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.String", TypeScriptLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.TimeSpan", TypeScriptLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.UInt16", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.UInt32", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.UInt64", TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Void", TypeScriptLanguage.Instance, "void", true, fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Array", TypeScriptLanguage.Instance, "Array", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Collections.Generic.IList", TypeScriptLanguage.Instance, "Array", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Collections.Generic.List", TypeScriptLanguage.Instance, "Array", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Collections.Generic.IEnumerable", TypeScriptLanguage.Instance, "Array", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Collections.Generic.Dictionary", TypeScriptLanguage.Instance, "Dictionary", fromSystem: true);
            typeMapping.Add(ReflectionLanguage.Instance, "System.Nullable", TypeScriptLanguage.Instance, "Nullable", nameSpace: "System", fromSystem: true);
            return(typeMapping);
        }
Exemplo n.º 4
0
        public static ITypeMapping Initialize(this ITypeMapping typeMapping)
        {
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Boolean.ToString(), CsharpLanguage.Instance, "bool", fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Bytes.ToString(), CsharpLanguage.Instance, "byte", fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Integer.ToString(), CsharpLanguage.Instance, "int", fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Float.ToString(), CsharpLanguage.Instance, "double", fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.String.ToString(), CsharpLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Date.ToString(), CsharpLanguage.Instance, "DateTime", false, "System", true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Guid.ToString(), CsharpLanguage.Instance, "Guid", false, "System", true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Uri.ToString(), CsharpLanguage.Instance, "Uri", false, "System", true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.TimeSpan.ToString(), CsharpLanguage.Instance, "TimeSpan", false, "System", true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Array.ToString(), CsharpLanguage.Instance, "List", false, "System.Collections.Generic", true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Object.ToString(), CsharpLanguage.Instance, "object");

            typeMapping.Add(JsonLanguage.Instance, JTokenType.Boolean.ToString(), TypeScriptLanguage.Instance, "boolean", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Bytes.ToString(), TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Integer.ToString(), TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Float.ToString(), TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.String.ToString(), TypeScriptLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Date.ToString(), TypeScriptLanguage.Instance, "Date", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Guid.ToString(), TypeScriptLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Uri.ToString(), TypeScriptLanguage.Instance, "string", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.TimeSpan.ToString(), TypeScriptLanguage.Instance, "number", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Array.ToString(), TypeScriptLanguage.Instance, "Array", true, fromSystem: true);
            typeMapping.Add(JsonLanguage.Instance, JTokenType.Object.ToString(), TypeScriptLanguage.Instance, "Object", true, fromSystem: true);
            return(typeMapping);
        }