示例#1
0
        // ...

        public static new SqlFormat GetSqlFormat(MethodCallExpression method, SqlDialectProvider dialectProvider)
        {
            switch (method.Method.Name)
            {
            case nameof(DateTime.SameYear):
                return(new SqlFormat("DATEDIFF(year, {0}, {1}) = 0", method.Arguments));

            case nameof(DateTime.SameQuarter):
                return(new SqlFormat("DATEDIFF(quarter, {0}, {1}) = 0", method.Arguments));

            // ...
            default:
                throw new NotSupportedException($"Method '{method.Method.Name}' is not supported.");
            }
        }
示例#2
0
        internal IEnumerable <string> GetCommands()
        {
            var commands = new List <string>();

            foreach (var item in Entities.GetAdded())
            {
                commands.Add(SqlDialectProvider.GetCreateCommand(EntityMapper.ToDataRecord(item), true));
            }

            foreach (var item in Entities.GetModified())
            {
                commands.Add(SqlDialectProvider.GetUpdateCommand(EntityMapper.ToDataRecord(item)));
            }

            foreach (var item in Entities.GetRemoved())
            {
                commands.Add(SqlDialectProvider.GetDeleteCommand(EntityMapper.ToDataRecord(item)));
            }

            return(commands);
        }