public DocumentStorage(DocumentMapping document) { _mapping = document; _document = document; Fields = document; TableName = document.Table; _defaultWhere = document.DefaultWhereFragment(); _selectClause = $"select {_document.SelectFields().Select(x => $"d.{x}").Join(", ")} from {document.Table.QualifiedName} as d"; _loaderSql = $"select {document.SelectFields().Join(", ")} from {document.Table.QualifiedName} as d where id = :id"; _loadArraySql = $"select {document.SelectFields().Join(", ")} from {document.Table.QualifiedName} as d where id = ANY(:ids)"; if (document.TenancyStyle == TenancyStyle.Conjoined) { _loaderSql += $" and {TenantWhereFragment.Filter}"; _loadArraySql += $" and {TenantWhereFragment.Filter}"; } QueryableDocument = document; UseOptimisticConcurrency = document.UseOptimisticConcurrency; _setter = LambdaBuilder.Setter <T, TId>(document.IdMember); }
public DocumentStorage(DocumentMapping document) { _document = document; Fields = document; TableName = document.Table; _defaultWhere = document.DefaultWhereFragment(); _selectClause = $"select {_document.SelectFields().Join(", ")} from {document.Table.QualifiedName} as d"; _loaderSql = $"select {document.SelectFields().Join(", ")} from {document.Table.QualifiedName} as d where id = :id"; _loadArraySql = $"select {document.SelectFields().Join(", ")} from {document.Table.QualifiedName} as d where id = ANY(:ids)"; if (document.TenancyStyle == TenancyStyle.Conjoined) { _loaderSql += $" and {TenantWhereFragment.Filter}"; _loadArraySql += $" and {TenantWhereFragment.Filter}"; } }
public DocumentStorage(DocumentMapping document) { _mapping = document; _document = document; Fields = document; TableName = document.Table; _defaultWhere = document.DefaultWhereFragment(); _idType = TypeMappings.ToDbType(typeof(TId)); _selectClause = $"select {_document.SelectFields().Select(x => $"d.{x}").Join(", ")} from {document.Table.QualifiedName} as d"; _loaderSql = $"select {document.SelectFields().Join(", ")} from {document.Table.QualifiedName} as d where id = :id"; _loadArraySql = $"select {document.SelectFields().Join(", ")} from {document.Table.QualifiedName} as d where id = ANY(:ids)"; if (document.TenancyStyle == TenancyStyle.Conjoined) { _loaderSql += $" and {TenantWhereFragment.Filter}"; _loadArraySql += $" and {TenantWhereFragment.Filter}"; } QueryableDocument = document; UseOptimisticConcurrency = document.UseOptimisticConcurrency; _setter = LambdaBuilder.Setter <T, TId>(document.IdMember); DeleteFragment = _mapping.DeleteStyle == DeleteStyle.Remove ? (IOperationFragment) new HardDelete(this) : new SoftDelete(this); }