public void ChnageFunctionalId() { FunctionalId toChangeFunctionalId = FunctionalIds.New("ChangeAccount", "CA_", IdFormat.Hash); Entities["Account"].Refactor.SetFunctionalId(toChangeFunctionalId, ApplyAlgorithm.ReapplyAll); Assert.AreEqual(Entities["Account"].FunctionalId, toChangeFunctionalId); }
public void Script_0_0_0() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("BaseEntity") .AddProperty("Uid", typeof(string), false, IndexType.Unique) .Abstract(true) .Virtual(true) .SetKey("Uid", true) .AddProperty("LastModifiedOn", typeof(DateTime)) .SetRowVersionField("LastModifiedOn"); Entities.New("Person", Entities["BaseEntity"]) .AddProperty("Name", typeof(string)); Entities.New("Movie", Entities["BaseEntity"]) .AddProperty("Title", typeof(string), IndexType.Unique) .AddProperty("ToMoveProperty", typeof(string)); Relations.New(Entities["Person"], Entities["Movie"], "PERSON_DIRECTED", "DIRECTED_BY") .SetInProperty("DirectedMovies", PropertyType.Collection) .SetOutProperty("Director", PropertyType.Lookup); Relations.New(Entities["Person"], Entities["Movie"], "ACTED_IN", "ACTORS") .SetInProperty("ActedInMovies", PropertyType.Collection) .SetOutProperty("Actors", PropertyType.Collection); }
public void Script_0_0_0() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("BaseEntity") .AddProperty("Uid", typeof(string), false, IndexType.Unique) .Abstract(true) .Virtual(true) .SetKey("Uid", true) .AddProperty("LastModifiedOn", typeof(DateTime)) .SetRowVersionField("LastModifiedOn"); Entities.New("Scene", Entities["BaseEntity"]) .AddProperty("Name", typeof(string), IndexType.Unique) .AddProperty("BoolToLong", typeof(bool)) .AddProperty("BoolToDouble", typeof(bool)) .AddProperty("BoolToString", typeof(bool)) .AddProperty("LongToBool", typeof(long)) .AddProperty("LongToDouble", typeof(long)) .AddProperty("LongToString", typeof(long)) .AddProperty("DoubleToBool", typeof(double)) .AddProperty("DoubleToLong", typeof(double)) .AddProperty("DoubleToString", typeof(double)) .AddProperty("StringToBool", typeof(string)) .AddProperty("StringToLong", typeof(string)) .AddProperty("StringToDouble", typeof(string)); }
public void UpdateFunctionalId() { FunctionalId account = FunctionalIds.New("Account", "A_", IdFormat.Hash); Entities["Account"].Refactor.SetFunctionalId(account); Assert.AreEqual(Entities["Account"].FunctionalId, account); }
public void Initialize() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("Account") .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("Name", typeof(string), false) .SetFullTextProperty("Name"); }
public void Initialize() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("BaseEntity") .AddProperty("Uid", typeof(string), false) .Abstract(true) .Virtual(true) .SetKey("Uid", true) .AddProperty("LastModifiedOn", typeof(DateTime)) .SetRowVersionField("LastModifiedOn"); }
public void Initialize() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("AccountType") .Summary("The type of an Account") .HasStaticData(true) .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("Name", typeof(string), false, IndexType.Unique) .SetFullTextProperty("Name"); Entities["AccountType"].Refactor.CreateNode(new { Uid = "6", Name = "Account" }); }
public void Script_0_0_0() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("BaseEntity") .AddProperty("Uid", typeof(string), false, IndexType.Unique) .Abstract(true) .Virtual(true) .SetKey("Uid", true) .AddProperty("LastModifiedOn", typeof(DateTime)) .SetRowVersionField("LastModifiedOn"); Entities.New("Person", Entities["BaseEntity"]) .AddProperty("Name", typeof(string)) .AddProperty("MandatoryProperty", typeof(int), false); Entities.New("Movie", Entities["BaseEntity"]) .AddProperty("Title", typeof(string), IndexType.Unique) .AddProperty("ReleaseDate", typeof(DateTime)); Relations.New(Entities["Person"], Entities["Movie"], "DIRECTED_BY", "DIRECTED_BY") .SetInProperty("DirectedMovies", PropertyType.Collection) .SetOutProperty("Director", PropertyType.Lookup); Relations.New(Entities["Person"], Entities["Movie"], "ACTED_IN", "ACTORS") .SetInProperty("ActedInMovies", PropertyType.Collection) .SetOutProperty("Actors", PropertyType.Collection); Entities.New("Genre", Entities["BaseEntity"]) .AddProperty("Name", typeof(string), IndexType.Unique) .HasStaticData(true) .SetFullTextProperty("Name"); Relations.New(Entities["Movie"], Entities["Genre"], "MOVIE_HAS", "MOVIE_HAS") .SetInProperty("MovieGenre", PropertyType.Lookup) .SetOutProperty("Movies", PropertyType.Collection); Relations.New(Entities["Person"], Entities["Genre"], "LIKES", "LIKES") .SetInProperty("MovieGenre", PropertyType.Lookup) .SetOutProperty("Person", PropertyType.Collection); Entities["Genre"].Refactor.CreateNode(new { Uid = "7", Name = "Action" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "8", Name = "Adventure" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "9", Name = "Comedy" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "10", Name = "Drama" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "11", Name = "Horror" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "12", Name = "Musical" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "13", Name = "Science Fiction" }); }
public void Initialize() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("ContactStatus") .HasStaticData(true) .AddProperty("OrderBy", typeof(string)) .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("Name", typeof(string), false, IndexType.Unique); Entities["ContactStatus"].Refactor.CreateNode(new { Uid = "1", Name = "Active", OrderBy = "1" }); Entities["ContactStatus"].Refactor.CreateNode(new { Uid = "2", Name = "Inactive", OrderBy = "5" }); Entities["ContactStatus"].Refactor.CreateNode(new { Uid = "3", Name = "Blacklisted", OrderBy = "10" }); }
public void Script_0_0_0() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("BaseEntityGenerator") .AddProperty("Uid", typeof(string), false, IndexType.Unique) .Abstract(true) .Virtual(true) .SetKey("Uid", true) .AddProperty("LastModifiedOn", typeof(DateTime)) .SetRowVersionField("LastModifiedOn"); Entities.New("PersonEntity", Entities["BaseEntityGenerator"]) .AddProperty("Name", typeof(string)); }
public void Initialize() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); FunctionalId account = FunctionalIds.New("Account", "A_", IdFormat.Hash); Entities.New("BaseAccount", account) .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true); Entities.New("Account", Entities["BaseAccount"]) .AddProperty("Name", typeof(string), false) .SetFullTextProperty("Name"); Assert.AreEqual(Entities["Account"].FunctionalId, account); }
public void Initialize() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("AccountType") .Summary("The type of an Account") .HasStaticData(true) .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("Name", typeof(string), false, IndexType.Unique) .SetFullTextProperty("Name"); Entities["AccountType"].Refactor.CreateNode(new { Uid = "6", Name = "Account" }); Entities["AccountType"].Refactor.CreateNode(new { Uid = "81", Name = "MTMSAccount" }); Entities["AccountType"].Refactor.CreateNode(new { Uid = "89", Name = "FinancialAccount" }); Entities["AccountType"].Refactor.CreateNode(new { Uid = "90", Name = "BillingAccount" }); Entities["AccountType"].Refactor.CreateNode(new { Uid = "91", Name = "AxaptaAccount" }); Entities["AccountType"].Refactor.CreateNode(new { Uid = "349", Name = "Aircraft" }); Entities["AccountType"].Refactor.CreateNode(new { Uid = "350", Name = "Installation" }); Entities["AccountType"].Refactor.CreateNode(new { Uid = "351", Name = "SiteTrackingObject" }); Entities["AccountType"].Refactor.CreateNode(new { Uid = "352", Name = "StaticSite" }); Entities["AccountType"].Refactor.CreateNode(new { Uid = "353", Name = "Vessel" }); Entities.New("ContactStatus") .Summary("The ContactStatus is describing the status of a Contact") .Example("Active, Inactive, Blacklisted") //.HasStaticData(true) .AddProperty("OrderBy", typeof(string)) .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("Name", typeof(string), false, IndexType.Unique); Entities["ContactStatus"].Refactor.CreateNode(new { Uid = "1", Name = "Active", OrderBy = "1" }); Entities["ContactStatus"].Refactor.CreateNode(new { Uid = "2", Name = "Inactive", OrderBy = "5" }); Entities["ContactStatus"].Refactor.CreateNode(new { Uid = "3", Name = "Blacklisted", OrderBy = "10" }); Entities.New("ReferenceType") .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("Name", typeof(string), false) .AddProperty("Fields", typeof(List <string>)); Entities["ReferenceType"].Refactor.CreateNode(new { Uid = "1", Name = "Opportunity", Fields = new List <string>() { "Field1" } }); }
public void Initialize() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("BaseOne") .Abstract(true) .Virtual(true) .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("LastModifiedOn", typeof(DateTime)) .SetRowVersionField("LastModifiedOn"); Entities.New("BaseTwo", Entities["BaseOne"]); Entities.New("Child", Entities["BaseOne"]) .AddProperty("Name", typeof(string), false); }
public void Initialize() { FunctionalIds.Default = FunctionalIds.New("Shared", "0", IdFormat.Numeric, 0); Entities.New("BaseEntityWithRowVersion") .AddProperty("Uid", typeof(string), false, IndexType.Unique) .Abstract(true) .Virtual(true) .SetKey("Uid", true) .AddProperty("LastModifiedOn", typeof(DateTime)) .SetRowVersionField("LastModifiedOn"); Entities.New("PersonInheritedBase", Entities["BaseEntityWithRowVersion"]) .AddProperty("Name", typeof(string)); Entities.New("AddressWithNoParent") .AddProperty("Name", typeof(string)) .AddProperty("LastModifiedOn", typeof(DateTime)); }
internal IReadOnlyList <ApplyFunctionalId> GetFunctionalIdDifferences() { List <ApplyFunctionalId> actions = new List <Schema.ApplyFunctionalId>(); foreach (var inMemory in Model.FunctionalIds) { long maxNumber = FindMaxId(inMemory); long startFrom = maxNumber > inMemory.StartFrom ? maxNumber : inMemory.StartFrom; var inDb = FunctionalIds.FirstOrDefault(item => inMemory.Label == item.Label); if (inDb is null) { actions.Add(NewApplyFunctionalId(inMemory.Label, inMemory.Prefix, startFrom, ApplyFunctionalIdAction.CreateFunctionalId)); continue; } if (inDb.Prefix != inMemory.Prefix || inDb.SequenceNumber < startFrom) { startFrom = startFrom > inDb.SequenceNumber ? startFrom : inDb.SequenceNumber; actions.Add( NewApplyFunctionalId( inDb.Label, inMemory.Prefix, startFrom, ApplyFunctionalIdAction.UpdateFunctionalId)); } } foreach (var inDb in FunctionalIds) { var inMemory = Model.FunctionalIds.FirstOrDefault(item => inDb.Label == item.Label); if (inMemory is null) { actions.Add(new Schema.ApplyFunctionalId(this, inDb.Label, inDb.Prefix, inDb.SequenceNumber, ApplyFunctionalIdAction.DeleteFunctionalId)); } } return(actions); }
/// <summary> /// Create the template output /// </summary> public override string TransformText() { this.Write("\r\n"); #line 10 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" foreach (var functionalId in FunctionalIds) { #line default #line hidden #line 13 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" if (functionalId.IsDefault == true) { #line default #line hidden this.Write(" FunctionalIds.Default = FunctionalIds.New(\""); #line 17 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionalId.Name)); #line default #line hidden this.Write("\", \""); #line 17 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionalId.Value)); #line default #line hidden this.Write("\", IdFormat."); #line 17 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionalId.Type)); #line default #line hidden this.Write(", 0);\r\n"); #line 18 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } else { #line default #line hidden this.Write(" FunctionalIds.New(\""); #line 21 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionalId.Name)); #line default #line hidden this.Write("\", \""); #line 21 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionalId.Value)); #line default #line hidden this.Write("\", IdFormat."); #line 21 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionalId.Type)); #line default #line hidden this.Write(", 0);\r\n"); #line 22 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } // end of else #line default #line hidden #line 25 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } // end of foreach functional id #line default #line hidden this.Write("\r\n\r\n"); #line 30 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" foreach (var entity in Entities) { if (string.IsNullOrEmpty(entity.Inherits)) { if (string.IsNullOrEmpty(entity.FunctionalId)) { #line default #line hidden this.Write(" Entities.New(\""); #line 38 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entity.Name)); #line default #line hidden this.Write("\")\r\n"); #line 39 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } else { var ids = FunctionalIds.Where(x => x.Guid == entity.FunctionalId && x.IsDefault == false).ToList(); string entityFunctionalId = ids.Count > 0 ? ", FunctionalIds[\"" + ids.First().Name + "\"]" : ""; #line default #line hidden this.Write(" Entities.New(\""); #line 46 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entity.Name)); #line default #line hidden this.Write("\""); #line 46 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityFunctionalId)); #line default #line hidden this.Write(")\r\n"); #line 47 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } } else { Entity inheritedEntity = Modeller.Model.Entities.Entity.Where(x => x.Guid == entity.Inherits).First(); string inheritedEntityName = inheritedEntity.Name; if (string.IsNullOrEmpty(entity.FunctionalId)) { #line default #line hidden this.Write(" Entities.New(\""); #line 57 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entity.Name)); #line default #line hidden this.Write("\", Entities[\""); #line 57 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(inheritedEntityName)); #line default #line hidden this.Write("\"])\r\n"); #line 58 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } else { var ids = FunctionalIds.Where(x => x.Guid == entity.FunctionalId && x.IsDefault == false).ToList(); string entityFunctionalId = ids.Count > 0 ? "FunctionalIds[\"" + ids.First().Name + "\"], " : ""; if (!string.IsNullOrEmpty(entity.FunctionalId) && !string.IsNullOrEmpty(inheritedEntity.FunctionalId)) { if (entity.FunctionalId == inheritedEntity.FunctionalId) { entityFunctionalId = ""; } } #line default #line hidden this.Write(" Entities.New(\""); #line 73 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entity.Name)); #line default #line hidden this.Write("\", "); #line 73 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityFunctionalId)); #line default #line hidden this.Write("Entities[\""); #line 73 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(inheritedEntityName)); #line default #line hidden this.Write("\"])\r\n"); #line 74 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } if (!string.IsNullOrEmpty(entity.Summary)) { #line default #line hidden this.Write(" .Summary(\""); #line 79 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entity.Summary.Replace("\"", "\\\""))); #line default #line hidden this.Write("\")\r\n"); #line 80 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } } if (entity.Abstract) { #line default #line hidden this.Write(" .Abstract(true)\r\n"); #line 87 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } if (entity.Virtual) { #line default #line hidden this.Write(" .Virtual(true)\r\n"); #line 93 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } if (entity.IsStaticData) { #line default #line hidden this.Write(" .HasStaticData(true)\r\n"); #line 99 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } foreach (var primitive in entity.Primitive) { if (!string.IsNullOrEmpty(primitive.Index) && !primitive.Index.Equals("None")) { #line default #line hidden this.Write(" .AddProperty(\""); #line 106 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(primitive.Name)); #line default #line hidden this.Write("\", typeof("); #line 106 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(primitive.Type)); #line default #line hidden this.Write("), "); #line 106 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(!primitive.Nullable?"false,":"")); #line default #line hidden this.Write(" IndexType."); #line 106 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(primitive.Index)); #line default #line hidden this.Write(")\r\n"); #line 107 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } else { #line default #line hidden this.Write(" .AddProperty(\""); #line 112 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(primitive.Name)); #line default #line hidden this.Write("\", typeof("); #line 112 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(primitive.Type ?? "")); #line default #line hidden this.Write(")"); #line 112 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(!primitive.Nullable?", false":"")); #line default #line hidden this.Write(")\r\n"); #line 113 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } if (primitive.IsKey) { #line default #line hidden this.Write(" .SetKey(\""); #line 118 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(primitive.Name)); #line default #line hidden this.Write("\", true)\r\n"); #line 119 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } } // end of foreach primitive Write(string.Join($"{Environment.NewLine}", entity.Primitive.Where(x => x.IsFullTextProperty == true).Select(x => ".SetFullTextProperty(\"" + x.Name + "\")").ToList())); GenerationEnvironment = TrimEnd(GenerationEnvironment); Write(";\r\n\r\n"); #line default #line hidden #line 126 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } // end foreach entities foreach (var relationship in Relationships) { bool hasRelationshipSourceName = string.IsNullOrEmpty(relationship.Source.Name); bool hasRelationshipTargetName = string.IsNullOrEmpty(relationship.Target.Name); string postfix = hasRelationshipTargetName ? ";" : ""; if (string.IsNullOrEmpty(relationship.Name)) { #line default #line hidden this.Write("\r\n Relations.New(Entities[\""); #line 138 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Source.Label)); #line default #line hidden this.Write("\"], "); #line 138 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Target.Label != null ? $"Entities[\"{relationship.Target.Label}\"]" : "null")); #line default #line hidden this.Write(", "); #line 138 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Type)); #line default #line hidden this.Write(")\r\n"); #line 139 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } else { #line default #line hidden this.Write("\r\n Relations.New(Entities[\""); #line 145 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Source.Label)); #line default #line hidden this.Write("\"], "); #line 145 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Target.Label != null ? $"Entities[\"{relationship.Target.Label}\"]" : "null")); #line default #line hidden this.Write(", \""); #line 145 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Name)); #line default #line hidden this.Write("\", \""); #line 145 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Type)); #line default #line hidden this.Write("\")\r\n"); #line 146 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } if (!hasRelationshipSourceName) { if (relationship.Source.Nullable) { #line default #line hidden this.Write(" .SetInProperty(\""); #line 153 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Source.Name)); #line default #line hidden this.Write("\", PropertyType."); #line 153 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Source.Type)); #line default #line hidden this.Write(")"); #line 153 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(postfix)); #line default #line hidden this.Write("\r\n"); #line 154 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } else { #line default #line hidden this.Write(" .SetInProperty(\""); #line 159 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Source.Name)); #line default #line hidden this.Write("\", PropertyType."); #line 159 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Source.Type)); #line default #line hidden this.Write(", "); #line 159 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Source.Nullable.ToString().ToLower())); #line default #line hidden this.Write(")"); #line 159 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(postfix)); #line default #line hidden this.Write("\r\n"); #line 160 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } } if (!hasRelationshipTargetName) { if (relationship.Target.Nullable) { #line default #line hidden this.Write(" .SetOutProperty(\""); #line 168 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Target.Name)); #line default #line hidden this.Write("\", PropertyType."); #line 168 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Target.Type)); #line default #line hidden this.Write(");\r\n"); #line 169 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } else { #line default #line hidden this.Write(" .SetOutProperty(\""); #line 174 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Target.Name)); #line default #line hidden this.Write("\", PropertyType."); #line 174 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Target.Type)); #line default #line hidden this.Write(", "); #line 174 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(relationship.Target.Nullable.ToString().ToLower())); #line default #line hidden this.Write(");\r\n"); #line 175 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } } else { } } // end of foreach entities #line default #line hidden this.Write("\r\n"); #line 184 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" foreach (var entity in Entities.Where(x => x.StaticData != null && x.StaticData?.Records.Record.Count > 0)) { foreach (var record in entity.StaticData.Records.Record) { var allProperties = new List <Primitive>(); Entity current = entity; do { allProperties.AddRange(current.Primitive); current = current.ParentEntity; } while (current != null); var primitiveRecords = record.Property.Where(r => allProperties.Any(p => p.Guid == r.PropertyGuid)); #line default #line hidden this.Write(" Entities[\""); #line 197 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entity.Name)); #line default #line hidden this.Write("\"].Refactor.CreateNode(new {"); #line 197 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" for (int index = 0; index < primitiveRecords.Count(); index++) { var prop = primitiveRecords.ElementAt(index); string comma = index == primitiveRecords.Count() - 1 ? " " : ","; string value = prop.Value.Replace("\"", "\\\""); var primitiveType = allProperties.Where(a => a.Guid == prop.PropertyGuid).FirstOrDefault().Type; var primitive = allProperties.Where(p => p.Guid == prop.PropertyGuid).FirstOrDefault(); #line default #line hidden this.Write(" "); #line 205 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(primitive.Name)); #line default #line hidden this.Write(" = "); #line 205 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" if (primitiveType == "List<string>") { var values = prop.Value.Substring(1, prop.Value.Length - 2).TrimEnd().TrimStart(); #line default #line hidden this.Write("new List<string>()"); #line 209 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" if (!string.IsNullOrEmpty(values)) { #line default #line hidden this.Write(" { "); #line 212 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(values)); #line default #line hidden this.Write(" }"); #line 212 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } } else { #line default #line hidden this.Write("\""); #line 216 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(value)); #line default #line hidden this.Write("\""); #line 216 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } #line default #line hidden #line 218 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" this.Write(this.ToStringHelper.ToStringWithCulture(comma)); #line default #line hidden #line 218 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } #line default #line hidden this.Write("});\r\n"); #line 221 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } #line default #line hidden this.Write("\r\n"); #line 225 "D:\_CirclesArrows\blueprint41\Blueprint41.Modeller\Generation\DatastoreModel.tt" } // end foreach entities #line default #line hidden return(this.GenerationEnvironment.ToString()); }
public void UpdateFunctionalId() { FunctionalId toChangeFunctionalId = FunctionalIds.New("ChangeAccount", "CA_", IdFormat.Hash); Entities["Account"].Refactor.SetFunctionalId(toChangeFunctionalId); }
protected void Initial() { FunctionalIds.Default = FunctionalIds.New("Shared", "SH_", IdFormat.Numeric, 0); Entities.New("Genre") .HasStaticData(true) .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("Name", typeof(string), false); Entities.New("Movie") .AddProperty("title", typeof(string)) .AddProperty("tagline", typeof(string)) .AddProperty("released", typeof(int)) .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true); Entities.New("MovieReview") .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("Review", typeof(string)) .AddProperty("Rating", typeof(decimal)); Entities.New("MovieRole") .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true) .AddProperty("Role", typeof(List <string>)); Entities.New("Person") .AddProperty("name", typeof(string)) .AddProperty("born", typeof(int)) .AddProperty("Uid", typeof(string), false, IndexType.Unique) .SetKey("Uid", true); Relations.New(Entities["Movie"], Entities["Genre"], "CONTAINS_GENRE", "CONTAINS_GENRE") .SetInProperty("Genres", PropertyType.Collection) .SetOutProperty("Movies", PropertyType.Collection); Relations.New(Entities["Person"], Entities["Movie"], "ACTED_IN", "ACTED_IN") .SetInProperty("ActedMovies", PropertyType.Collection) .SetOutProperty("Actors", PropertyType.Collection); Relations.New(Entities["Person"], Entities["Movie"], "DIRECTED", "DIRECTED") .SetInProperty("DirectedMovies", PropertyType.Collection) .SetOutProperty("Directors", PropertyType.Collection); Relations.New(Entities["Person"], Entities["Movie"], "PRODUCED", "PRODUCED") .SetInProperty("ProducedMovies", PropertyType.Collection) .SetOutProperty("Producers", PropertyType.Collection); Relations.New(Entities["Person"], Entities["Movie"], "WROTE", "WROTE") .SetInProperty("WritedMovies", PropertyType.Collection) .SetOutProperty("Writers", PropertyType.Collection); Relations.New(Entities["MovieRole"], Entities["Movie"], "MOVIEROLE_HAS_MOVIE", "HAS_MOVIE") .SetInProperty("Movie", PropertyType.Lookup); Relations.New(Entities["MovieReview"], Entities["Movie"], "MOVIEREVIEW_HAS_MOVIE", "HAS_REVIEWED_MOVIE") .SetInProperty("Movie", PropertyType.Lookup); Relations.New(Entities["Person"], Entities["MovieReview"], "MOVIE_REVIEWS", "MOVIE_REVIEWS") .SetInProperty("MovieReviews", PropertyType.Collection); Relations.New(Entities["Person"], Entities["MovieRole"], "MOVIE_ROLES", "MOVIE_ROLES") .SetInProperty("MovieRoles", PropertyType.Collection); Relations.New(Entities["Person"], Entities["Person"], "FOLLOWS", "FOLLOWS") .SetInProperty("FollowedPersons", PropertyType.Collection) .SetOutProperty("Followers", PropertyType.Collection); Entities["Genre"].Refactor.CreateNode(new { Uid = "1", Name = "Action" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "2", Name = "Animation" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "3", Name = "Biography" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "4", Name = "Comedy" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "5", Name = "Documentary" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "6", Name = "Drama" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "7", Name = "Fantasy" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "8", Name = "Horror" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "9", Name = "Musical" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "10", Name = "Reality-Tv" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "11", Name = "Romance" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "12", Name = "Sci-Fi" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "13", Name = "Short" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "14", Name = "Talk-Show" }); Entities["Genre"].Refactor.CreateNode(new { Uid = "15", Name = "Thriller" }); }