Example #1
0
        internal void NewAutoSetColumn <T>(Before before, Enum columnName, Enum schemaName, Enum dbFunctionName, Func <object> functionDelegate, AutoSetValueProvider autoSetValueProvider)
        {
            DB.throwIfNullOrEmpty <MappingException>(before, "Before");
            DB.throwIfNullOrEmpty <MappingException>(columnName, "Column name");

            if (autoSetValueProvider == AutoSetValueProvider.AppFunctionDelegate)
            {
                DB.throwIfNullOrEmpty <MappingException>(functionDelegate, "Function delegate");
            }
            else if (autoSetValueProvider == AutoSetValueProvider.DBFunction)
            {
                //DB.throwIfNullOrEmpty<MappingException>(schemaName, "Schema name");
                DB.throwIfNullOrEmpty <MappingException>(dbFunctionName, "DB function name");
            }

            if (before == Before.Insert)
            {
                entityMapping.InsertAutoSetColumnMappingDictionary.Add(columnName.ToString(), new AutoSetColumnMapping(columnName.ToString(), schemaName, dbFunctionName, functionDelegate, autoSetValueProvider));
            }
            else if (before == Before.Update)
            {
                entityMapping.UpdateAutoSetColumnMappingDictionary.Add(columnName.ToString(), new AutoSetColumnMapping(columnName.ToString(), schemaName, dbFunctionName, functionDelegate, autoSetValueProvider));
            }
            else if (before == Before.LogicalDelete)
            {
                entityMapping.LogicalDeleteAutoSetColumnMappingDictionary.Add(columnName.ToString(), new AutoSetColumnMapping(columnName.ToString(), schemaName, dbFunctionName, functionDelegate, autoSetValueProvider));
            }

            entityMapping.throwIfAutoSetAndPrimaryKeyColumn(columnName.ToString());
            entityMapping.throwIfAutoSetAndTimestampColumn(columnName.ToString());
        }
Example #2
0
 public AutoSetColumn <T> Add(Before before, Enum columnName, Enum schemaName, Enum dbFunctionName, Func <object> functionDelegate, AutoSetValueProvider autoSetValueProvider)
 {
     entityMapper.NewAutoSetColumn <T>(before, columnName, schemaName, dbFunctionName, functionDelegate, autoSetValueProvider);
     return(this);
 }