예제 #1
0
        public PetaPocoMap <T> CompositePrimaryKey(params Expression <Func <T, object> >[] columns)
        {
            var columnNames = new string[columns.Length];

            for (int i = 0; i < columns.Length; i++)
            {
                columnNames[i] = PropertyHelper <T> .GetProperty(columns[i]).Name;
            }

            _petaPocoTypeDefinition.PrimaryKey = string.Join(",", columnNames);
            return(this);
        }
예제 #2
0
        private void SetColumnDefinition(Expression <Func <T, object> > property, string dbColumnName, bool?ignoreColumn, bool?resultColumn, bool?versionColumn)
        {
            var propertyInfo = PropertyHelper <T> .GetProperty(property);

            _columnDefinitions[propertyInfo.Name] = new PetaPocoColumnDefinition
            {
                PropertyInfo  = propertyInfo,
                DbColumnName  = dbColumnName,
                ResultColumn  = resultColumn,
                IgnoreColumn  = ignoreColumn,
                VersionColumn = versionColumn
            };
        }
예제 #3
0
        public PetaPocoMap <T> PrimaryKey(Expression <Func <T, object> > column, bool autoIncrement)
        {
            var propertyInfo = PropertyHelper <T> .GetProperty(column);

            return(PrimaryKey(propertyInfo.Name, autoIncrement));
        }
예제 #4
0
        public PetaPocoMap <T> PrimaryKey(Expression <Func <T, object> > column, string sequenceName)
        {
            var propertyInfo = PropertyHelper <T> .GetProperty(column);

            return(PrimaryKey(propertyInfo.Name, sequenceName));
        }