public void should_createobject_nullable() { int ID = Zetbox.API.Helper.INVALIDID; using (Zetbox.API.IZetboxContext ctx = GetContext()) { var obj = ctx.Create <Zetbox.App.Test.TestCustomObject>(); obj.PersonName = "TestPerson " + rnd.Next(); obj.Birthday = DateTime.Now; Assert.That(obj.PhoneNumberMobile, Is.Not.Null); Assert.That(obj.PhoneNumberOffice, Is.Not.Null); obj.PhoneNumberOffice.AreaCode = "2"; obj.PhoneNumberOffice.Number = testNumber; Assert.That(ctx.SubmitChanges(), Is.EqualTo(1)); ID = obj.ID; } using (Zetbox.API.IZetboxContext ctx = GetContext()) { var obj = ctx.Find <Zetbox.App.Test.TestCustomObject>(ID); Assert.That(obj, Is.Not.Null); Assert.That(obj.PhoneNumberMobile, Is.Not.Null); Assert.That(obj.PhoneNumberOffice, Is.Not.Null); Assert.That(obj.PhoneNumberOffice.Number, Is.EqualTo(testNumber)); } }
public void GetListOfInheritedObjects() { using (Zetbox.API.IZetboxContext ctx = GetContext()) { bool intFound = false; bool stringFound = false; var list = ctx.GetQuery <Zetbox.App.Base.Property>().ToList(); Assert.That(list.Count, Is.GreaterThan(0)); foreach (Zetbox.App.Base.Property bp in list) { if (bp is Zetbox.App.Base.IntProperty) { intFound = true; } if (bp is Zetbox.App.Base.StringProperty) { stringFound = true; } } Assert.That(intFound, Is.True); Assert.That(stringFound, Is.True); } }
public ProjectFile(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx, string projectGuid, List <string> fileNames, IEnumerable <ISchemaProvider> schemaProviders) : base(_host) { this.ctx = ctx; this.projectGuid = projectGuid; this.fileNames = fileNames; this.schemaProviders = schemaProviders; }
public static void Call(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx, string projectGuid, List <string> fileNames, IEnumerable <ISchemaProvider> schemaProviders) { if (_host == null) { throw new global::System.ArgumentNullException("_host"); } _host.CallTemplate("ProjectFile", ctx, projectGuid, fileNames, schemaProviders); }
public static void Call(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx) { if (_host == null) { throw new global::System.ArgumentNullException("_host"); } _host.CallTemplate("AssemblyInfoTemplate", ctx); }
public ProjectFile(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx, string projectGuid, List<string> fileNames, IEnumerable<ISchemaProvider> schemaProviders) : base(_host) { this.ctx = ctx; this.projectGuid = projectGuid; this.fileNames = fileNames; this.schemaProviders = schemaProviders; }
protected override IEnumerable <string> Generate_Other(Zetbox.API.IZetboxContext ctx) { using (log4net.NDC.Push("NhGenerateOther")) { var otherFileNames = new List <string>(); otherFileNames.AddRange(CreateMappings(ctx)); return(base.Generate_Other(ctx).Concat(otherFileNames)); } }
private List <string> CreateMappings(Zetbox.API.IZetboxContext ctx) { this.RunTemplateWithExtension(ctx, "Mappings.CollectionEntriesHbm", "CollectionEntries", "hbm.xml"); foreach (var oc in ctx.GetQuery <ObjectClass>().Where(i => i.BaseObjectClass == null)) { this.RunTemplateWithExtension(ctx, "Mappings.ObjectClassHbm", oc.Name, "hbm.xml", Templates.Mappings.ObjectClassHbm.MakeArgs(ctx, oc, new NameValueCollection() { { "extrasuffix", ExtraSuffix } })); } // Mapping files are picked up automatically by the ProjectFile // so we don't need to keep track of them. return(new List <string>()); }
protected override IEnumerable <string> Generate_Other(Zetbox.API.IZetboxContext ctx) { using (log4net.NDC.Push("EfGenerateOther")) { var otherFileNames = new List <string>(); // those are not compilable, therefore don't add them to otherFileNames. // should be handled separately in the ProjectFile Template this.RunTemplate(ctx, "EfModel.ModelCsdl", "Model.csdl"); this.RunTemplate(ctx, "EfModel.ModelMsl", "Model.msl"); foreach (var schemaProvider in SchemaProviders.Where(sp => sp.IsStorageProvider)) { this.RunTemplate(ctx, "EfModel.ModelSsdl", String.Format("Model.{0}.ssdl", schemaProvider.ConfigName), schemaProvider); } otherFileNames.Add(this.RunTemplateWithExtension(ctx, "ObjectClasses.AssociationSetAttributes", "AssociationSetAttributes", "cs")); return(base.Generate_Other(ctx).Concat(otherFileNames)); } }
public Template(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx, ObjectClass cls) : base(_host, ctx, cls) { }
public AssemblyInfoTemplate(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx) : base(_host, ctx) { }
public AssemblyInfoTemplate(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx) : base(_host) { this.ctx = ctx; }
public ProjectFile(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx, string projectGuid, List <string> fileNames, IEnumerable <ISchemaProvider> schemaProviders) : base(_host, ctx, projectGuid, fileNames, schemaProviders) { }
public ListProperty(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx, Templates.Serialization.SerializationMembersList list, DataType containingType, String name, Property property) : base(_host, ctx, list, containingType, name, property) { }