Esempio n. 1
0
 public Templates(Schema Schema)
 {
     this.Inner = new OS.CSharp.Templates(new OS.Schema
     {
         Types    = new List <OS.TypeDef> {
         },
         TypeRefs = new List <OS.TypeDef>
         {
             OS.TypeDef.CreatePrimitive(new OS.PrimitiveDef {
                 Name = new List <String> {
                     "Unit"
                 }, GenericParameters = new List <OS.VariableDef> {
                 }, Description = "", Attributes = new List <KeyValuePair <String, List <String> > > {
                 }
             }),
             OS.TypeDef.CreatePrimitive(new OS.PrimitiveDef {
                 Name = new List <String> {
                     "Boolean"
                 }, GenericParameters = new List <OS.VariableDef> {
                 }, Description = "", Attributes = new List <KeyValuePair <String, List <String> > > {
                 }
             })
         },
         Imports = new List <String> {
         }
     });
 }
Esempio n. 2
0
            public Writer(Schema Schema, String DatabaseName, String EntityNamespaceName, String ContextNamespaceName, String ContextClassName)
            {
                this.Schema               = Schema;
                this.DatabaseName         = DatabaseName;
                this.EntityNamespaceName  = EntityNamespaceName;
                this.ContextNamespaceName = ContextNamespaceName;
                this.ContextClassName     = ContextClassName;
                InnerWriter               = new OS.CSharp.Templates(new OS.Schema
                {
                    Types    = new List <OS.TypeDef> {
                    },
                    TypeRefs = new List <OS.TypeDef>
                    {
                        OS.TypeDef.CreatePrimitive(new OS.PrimitiveDef {
                            Name = new List <String> {
                                "Unit"
                            }, GenericParameters = new List <OS.VariableDef> {
                            }, Description = "", Attributes = new List <KeyValuePair <String, List <String> > > {
                            }
                        }),
                        OS.TypeDef.CreatePrimitive(new OS.PrimitiveDef {
                            Name = new List <String> {
                                "Boolean"
                            }, GenericParameters = new List <OS.VariableDef> {
                            }, Description = "", Attributes = new List <KeyValuePair <String, List <String> > > {
                            }
                        })
                    },
                    Imports = new List <String> {
                    }
                });

                Enums   = Schema.TypeRefs.Concat(Schema.Types).Where(t => t.OnEnum).Select(t => t.Enum).ToDictionary(e => e.Name, StringComparer.OrdinalIgnoreCase);
                Records = Schema.Types.Where(t => t.OnEntity).Select(t => t.Entity).ToDictionary(r => r.Name, StringComparer.OrdinalIgnoreCase);
            }
Esempio n. 3
0
            public Writer(Schema Schema, String NamespaceName, Boolean WithFirefly = true)
            {
                this.Schema        = Schema;
                this.NamespaceName = NamespaceName;
                InnerSchema        = PlainObjectSchemaGenerator.Generate(Schema, NamespaceName);
                TypeDict           = OS.ObjectSchemaExtensions.GetMap(InnerSchema).ToDictionary(p => p.Key.Split('.').Last(), p => p.Value, StringComparer.OrdinalIgnoreCase);
                InnerWriter        = new OS.CSharp.Templates(InnerSchema);

                if (!Schema.TypeRefs.Concat(Schema.Types).Where(t => t.OnPrimitive && t.Primitive.Name == "Int").Any())
                {
                    throw new InvalidOperationException("PrimitiveMissing: Int");
                }
            }