Beispiel #1
0
        internal void NewPrimaryKey <T>(Enum columnName, Expression <Func <T, object> > memberExpression, Enum sequenceName, Enum schemaName, Enum dbFunctionName, Func <object> functionDelegate, PrimaryKeyValueProvider primaryKeyValueProvider)
        {
            DB.throwIfNullOrEmpty <MappingException>(columnName, "Column name");

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

            string nestedPrimaryKeyPropertyName = parseNestedPropertyNameFromMemberExpression <T>(memberExpression);

            DB.throwIfNullOrEmpty <MappingException>(nestedPrimaryKeyPropertyName, "Primary key property name");

            entityMapping.PrimaryKeyMapping.AddProperty(nestedPrimaryKeyPropertyName, sequenceName, schemaName, dbFunctionName, functionDelegate, primaryKeyValueProvider);
            newColumn(columnName, nestedPrimaryKeyPropertyName, true, false);
            entityMapping.RefreshPrimaryKeyColumnNameList();

            entityMapping.throwIfAutoSetAndPrimaryKeyColumn(columnName.ToString());
        }