public TableIndex AddIndexMList <T, V>(Expression <Func <T, MList <V> > > toMList, Expression <Func <MListElement <T, V>, object> > fields, Expression <Func <MListElement <T, V>, bool> >?where = null, Expression <Func <MListElement <T, V>, object> >?includeFields = null) where T : Entity { TableMList table = ((FieldMList)Schema.FindField(Schema.Table(typeof(T)), Reflector.GetMemberList(toMList))).TableMList; IColumn[] columns = IndexKeyColumns.Split(table, fields); var index = AddIndex(table, columns); if (where != null) { index.Where = IndexWhereExpressionVisitor.GetIndexWhere(where, table); } if (includeFields != null) { index.IncludeColumns = IndexKeyColumns.Split(table, includeFields); if (table.SystemVersioned != null) { index.IncludeColumns = index.IncludeColumns.Concat(table.SystemVersioned.Columns()).ToArray(); } } return(index); }
public Index AddIndex <T>(Expression <Func <T, object> > fields, Expression <Func <T, bool> > where = null, Expression <Func <T, object> > includeFields = null) where T : Entity { var table = Schema.Table <T>(); IColumn[] columns = IndexKeyColumns.Split(table, fields); var index = new Index(table, columns); if (where != null) { index.Where = IndexWhereExpressionVisitor.GetIndexWhere(where, table); } if (includeFields != null) { index.IncludeColumns = IndexKeyColumns.Split(table, includeFields); if (table.SystemVersioned != null) { index.IncludeColumns = index.IncludeColumns.Concat(table.SystemVersioned.Columns()).ToArray(); } } AddIndex(index); return(index); }
public UniqueIndex AddUniqueIndex <T>(Expression <Func <T, object> > fields, Expression <Func <T, bool> > where = null) where T : Entity { var table = Schema.Table <T>(); IColumn[] columns = IndexKeyColumns.Split(table, fields); var index = AddUniqueIndex(table, columns); if (where != null) { index.Where = IndexWhereExpressionVisitor.GetIndexWhere(where, table); } return(index); }
public UniqueIndex AddUniqueIndexMList <T, V>(Expression <Func <T, MList <V> > > toMList, Expression <Func <MListElement <T, V>, object> > fields, Expression <Func <MListElement <T, V>, bool> > where) where T : Entity { TableMList table = ((FieldMList)Schema.FindField(Schema.Table(typeof(T)), Reflector.GetMemberList(toMList))).TableMList; IColumn[] columns = IndexKeyColumns.Split(table, fields); var index = AddUniqueIndex(table, columns); if (where != null) { index.Where = IndexWhereExpressionVisitor.GetIndexWhere(where, table); } return(index); }