public IColumnBuilder <TModel> Reference(Expression <Func <TModel, object> > member, ReferenceType referenceType = ReferenceType.Foreign) { Reference(referenceType); _columnDefinition.ReferenceMember = MemberHelper <TModel> .GetMembers(member).Last(); return(this); }
public IManyColumnBuilder <TModel> Reference(Expression <Func <TModel, object> > member) { _columnDefinition.IsReferenceMember = true; _columnDefinition.ReferenceType = ReferenceType.Many; _columnDefinition.ReferenceMember = MemberHelper <TModel> .GetMembers(member).Last(); return(this); }
public Map <T> CompositePrimaryKey(params Expression <Func <T, object> >[] columns) { var columnNames = new string[columns.Length]; for (int i = 0; i < columns.Length; i++) { columnNames[i] = MemberHelper <T> .GetMembers(columns[i]).Last().Name; } _petaPocoTypeDefinition.PrimaryKey = string.Join(",", columnNames); return(this); }
public IManyColumnBuilder <T2> Many <T2>(Expression <Func <T, IList <T2> > > property) { var members = MemberHelper <T> .GetMembers(property); var columnDefinition = new ColumnDefinition() { MemberInfo = members.Last() }; var builder = new ManyColumnBuilder <T2>(columnDefinition); var key = PocoColumn.GenerateKey(members); _columnDefinitions[key] = columnDefinition; return(builder); }
public IColumnBuilder <TModel> ValueObject(Expression <Func <TModel, object> > member) { ValueObject(); ValueObject(MemberHelper <TModel> .GetMembers(member).Last().Name); return(this); }
public Map <T> PrimaryKey(Expression <Func <T, object> > column, bool autoIncrement) { var members = MemberHelper <T> .GetMembers(column); return(PrimaryKey(members.Last().Name, autoIncrement)); }
public Map <T> PrimaryKey(Expression <Func <T, object> > column, string sequenceName) { var members = MemberHelper <T> .GetMembers(column); return(PrimaryKey(members.Last().Name, sequenceName)); }