/// <summary> /// Creates an id for the store object that the given entity type is mapped to. /// </summary> /// <param name="entityType"> The entity type. </param> /// <param name="type"> The store object type. </param> /// <returns> The store object id. </returns> public static StoreObjectIdentifier?Create(IReadOnlyEntityType entityType, StoreObjectType type) { Check.NotNull(entityType, nameof(entityType)); switch (type) { case StoreObjectType.Table: var tableName = entityType.GetTableName(); return(tableName == null ? null : Table(tableName, entityType.GetSchema())); case StoreObjectType.View: var viewName = entityType.GetViewName(); return(viewName == null ? null : View(viewName, entityType.GetViewSchema())); case StoreObjectType.SqlQuery: var query = entityType.GetSqlQuery(); return(query == null ? null : SqlQuery(entityType)); case StoreObjectType.Function: var functionName = entityType.GetFunctionName(); return(functionName == null ? null : DbFunction(functionName)); default: return(null); } }