public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { var newConcepts = new List<IConceptInfo>(); var persisted = new EntityInfo { Module = Polymorphic.Module, Name = Polymorphic.Name + "_Materialized" }; newConcepts.Add(persisted); var computedFrom = new EntityComputedFromInfo { Target = persisted, Source = Polymorphic }; newConcepts.Add(computedFrom); newConcepts.Add(new KeepSynchronizedInfo { EntityComputedFrom = computedFrom, FilterSaveExpression = "" }); // Optimized filter by subtype allows efficient queryies on the polymophic's view, // but it does not need to use the subtype name (and persist it) when querying the materialized data. newConcepts.Add(new FilterByInfo { Source = persisted, Parameter = "Rhetos.Dom.DefaultConcepts.FilterSubtype", Expression = @"(repository, parameter) => Filter(parameter.Ids)" }); return newConcepts; }
public void InitializeNonparsableProperties(out IEnumerable<IConceptInfo> createdConcepts) { Dependency_ChangesEntity = new EntityInfo { Module = Entity.Module, Name = Entity.Name + "_Changes" }; Dependency_HistorySqlQueryable = new SqlQueryableInfo { Module = Entity.Module, Name = Entity.Name + "_History", SqlSource = HistorySqlSnippet() }; Dependency_AtTimeSqlFunction = new SqlFunctionInfo { Module = Entity.Module, Name = Entity.Name + "_AtTime", Arguments = "@ContextTime DATETIME", Source = AtTimeSqlSnippet() }; Dependency_Write = new WriteInfo { DataStructure = Dependency_HistorySqlQueryable, SaveImplementation = HistorySaveFunction() }; createdConcepts = new IConceptInfo[] { Dependency_ChangesEntity, Dependency_HistorySqlQueryable, Dependency_AtTimeSqlFunction, Dependency_Write }; }
private string PrimaryKeyConstraintName(EntityInfo info) { return SqlUtility.Identifier(Sql.Format("EntityDatabaseDefinition_PrimaryKeyConstraintName", info.Module.Name, info.Name)); }