src/Inflatable/QueryProvider/Providers/SQLServer/QueryGenerators/LoadPropertiesQuery.cs
/// <summary>
/// Loads the many to one property.
/// </summary>
/// <param name="manyToOne">The many to one.</param>
/// <param name="queryObject">The query object.</param>
/// <returns></returns>
Loads the many to one property.
Loads the many to one property .
private IQuery[] LoadManyToOneProperty(IManyToOneListProperty manyToOne, TMappedClass queryObject)
        {
            if (!(manyToOne.LoadPropertyQuery is null))
            {
                return new IQuery[] {
                    new Query(manyToOne.LoadPropertyQuery.ReturnType,
                        manyToOne.LoadPropertyQuery.DatabaseCommandType,
                        manyToOne.LoadPropertyQuery.QueryString,
                        manyToOne.LoadPropertyQuery.QueryType,
                        GenerateParameters(queryObject, IDProperties))
                };
            }
            var ChildMappings = MappingInformation.GetChildMappings(manyToOne.PropertyType);
            var ReturnValue = new List<IQuery>();
            if (!Queries.ContainsKey(manyToOne.Name))
            {
                lock (LockObject)
                {
                    if (!Queries.ContainsKey(manyToOne.Name))
                    {
                        foreach (var ChildMapping in ChildMappings)
                        {
                            var ForeignTypeGraph = MappingInformation.TypeGraphs[ChildMapping.ObjectType];
                            Queries.Add(manyToOne.Name, new QueryGeneratorData(
                                ChildMapping,
                                IDProperties,
                                GenerateSelectQuery(ForeignTypeGraph, manyToOne)
                            ));
                        }
                    }
                }
            }
            foreach (var TempQuery in Queries[manyToOne.Name])
            {
                ReturnValue.Add(new Query(TempQuery.AssociatedMapping.ObjectType, CommandType.Text, TempQuery.QueryText, QueryType.LoadProperty, GenerateParameters(queryObject, TempQuery.IDProperties)));
            }
            return ReturnValue.ToArray();
        }
private IQuery [ ] LoadManyToOneProperty ( IManyToOneListProperty manyToOne , TMappedClass queryObject ) { if ( ! ( manyToOne . LoadPropertyQuery is null ) ) { return new IQuery [ ] { new Query ( manyToOne . LoadPropertyQuery . ReturnType , manyToOne . LoadPropertyQuery . DatabaseCommandType , manyToOne . LoadPropertyQuery . QueryString , manyToOne . LoadPropertyQuery . QueryType , GenerateParameters ( queryObject , IDProperties ) ) } ; } var ChildMappings = MappingInformation . GetChildMappings ( manyToOne . PropertyType ) ; var ReturnValue = new List < IQuery > ( ) ; if ( ! Queries . ContainsKey ( manyToOne . Name ) ) { lock ( LockObject ) { if ( ! Queries . ContainsKey ( manyToOne . Name ) ) { foreach ( var ChildMapping in ChildMappings ) { var ForeignTypeGraph = MappingInformation . TypeGraphs [ ChildMapping . ObjectType ] ; Queries . Add ( manyToOne . Name , new QueryGeneratorData ( ChildMapping , IDProperties , GenerateSelectQuery ( ForeignTypeGraph , manyToOne ) ) ) ; } } } } foreach ( var TempQuery in Queries [ manyToOne . Name ] ) { ReturnValue . Add ( new Query ( TempQuery . AssociatedMapping . ObjectType , CommandType . Text , TempQuery . QueryText , QueryType . LoadProperty , GenerateParameters ( queryObject , TempQuery . IDProperties ) ) ) ; } return ReturnValue . ToArray ( ) ; }
Loads the many to one property.
Loads the many to one property .
None
manyToOne
IManyToOneListProperty
The many to one.
The many to one .
queryObject
TMappedClass
The query object.
The query object .