public TableBuilder <TColumns> Index( Expression <Func <TColumns, object> > indexExpression, bool unique = false, bool clustered = false, object anonymousArguments = null) { Check.NotNull(indexExpression, "indexExpression"); var createIndexOperation = new CreateIndexOperation(anonymousArguments) { Table = _createTableOperation.Name, IsUnique = unique, IsClustered = clustered }; indexExpression .GetSimplePropertyAccessList() .Select(p => _createTableOperation.Columns.Single(c => c.ApiPropertyInfo == p.Single())) .Each(c => createIndexOperation.Columns.Add(c.Name)); _migration.AddOperation(createIndexOperation); return(this); }
public TableBuilder <TColumns> Index( Expression <Func <TColumns, object> > indexExpression, bool unique = false, object anonymousArguments = null) { Check.NotNull(indexExpression, "indexExpression"); var createIndexOperation = new CreateIndexOperation(anonymousArguments) { Table = _createTableOperation.Name, IsUnique = unique }; indexExpression .GetPropertyAccessList() .Select(p => p.Last().Name) .Each(c => createIndexOperation.Columns.Add(c)); _migration.AddOperation(createIndexOperation); return(this); }