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(", ") )); }
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(", ")})"); }