src/Inflatable/QueryProvider/Providers/SQLServer/QueryGenerators/InsertQuery.cs
/// <summary>
/// Generates the insert query declarations.
/// </summary>
/// <returns>The resulting query</returns>
Generates the insert query declarations.
Generates the insert query declarations .
private string[] GenerateInsertQueryDeclarations()
        {
            var Builder = new List<string>();
            var ParentMappings = new List<IMapping>();
            foreach (var ChildMapping in MappingInformation.GetChildMappings(typeof(TMappedClass)))
            {
                var TempParentMappings = MappingInformation.GetParentMapping(ChildMapping.ObjectType);
                ParentMappings.AddIfUnique(TempParentMappings);
            }
            for (int x = 0, ParentMappingsCount = ParentMappings.Count; x < ParentMappingsCount; x++)
            {
                var ParentMapping = ParentMappings[x];
                foreach (var IDProperty in ParentMapping.IDProperties)
                {
                    Builder.Add("DECLARE " + GetParentParameterName(IDProperty) + " AS " + GetParameterType(IDProperty) + ";");
                }
                foreach (var AutoIDProperty in ParentMapping.AutoIDProperties)
                {
                    Builder.Add("DECLARE " + GetParentParameterName(AutoIDProperty) + " AS " + GetParameterType(AutoIDProperty) + ";");
                }
            }
            return Builder.ToArray();
        }
private string [ ] GenerateInsertQueryDeclarations ( ) { var Builder = new List < string > ( ) ; var ParentMappings = new List < IMapping > ( ) ; foreach ( var ChildMapping in MappingInformation . GetChildMappings ( typeof ( TMappedClass ) ) ) { var TempParentMappings = MappingInformation . GetParentMapping ( ChildMapping . ObjectType ) ; ParentMappings . AddIfUnique ( TempParentMappings ) ; } for ( int x = 0 , ParentMappingsCount = ParentMappings . Count ; x < ParentMappingsCount ; x ++ ) { var ParentMapping = ParentMappings [ x ] ; foreach ( var IDProperty in ParentMapping . IDProperties ) { Builder . Add ( " " + GetParentParameterName ( IDProperty ) + " " + GetParameterType ( IDProperty ) + " " ) ; } foreach ( var AutoIDProperty in ParentMapping . AutoIDProperties ) { Builder . Add ( " " + GetParentParameterName ( AutoIDProperty ) + " " + GetParameterType ( AutoIDProperty ) + " " ) ; } } return Builder . ToArray ( ) ; }
Generates the insert query declarations.
Generates the insert query declarations .
//ID Properties to pass to the next set of queries //Auto ID properties to pass to the next set of queries
The resulting query
The resulting query