Exemplo n.º 1
0
        public virtual string GenerateInsertCommand(IDataProviderMetaData metaData)
        {
            var properties = metaData.GetPropertiesForInsert();

            return(GetInsertCommandTemplate(metaData).FormatWith(
                       GetFullTableName(metaData),
                       properties.Select(x => SafeId(x.Name)).ToString(", "),
                       properties.Select(x => $"@{x.ParameterName}").ToString(", ")
                       ));
        }
Exemplo n.º 2
0
        public virtual string GenerateInsertCommand(IDataProviderMetaData metaData)
        {
            var properties = metaData.GetPropertiesForInsert();

            var autoNumber = metaData.AutoNumberProperty;

            return($@"INSERT INTO {GetFullTablaName(metaData)}
                ({properties.Select(x => SafeId(x.Name)).ToString(", ")})
                {$"OUTPUT [INSERTED].{autoNumber?.Name}".OnlyWhen(autoNumber != null)}
                VALUES
                ({properties.Select(x => $"@{x.ParameterName}").ToString(", ")})");
        }