Show / Hide Table of Contents

    ModelSqlBuilder.GetQueryBuilder(string selectName) Method

    .NET Standard 2.x

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Gets a newly created ISqlQueryBuilder object based on the definition in the model class and the specified select list.

    Syntax

    public ISqlQueryBuilder GetQueryBuilder(string selectName)
    

    Parameters

    selectName System.String

    The name of the select list predefined in the model class.

    Returns

    SnapObjects.Data.ISqlQueryBuilder

    Returns the newly created ISqlQueryBuilder object.

    Examples

    The following code example returns an ISqlQueryBuilder object with the SQL SELECT statement in the associated model of the ModelSqlBuilder object.

    using Appeon.ApiDoc.Models.School;
    using SnapObjects.Data;
    
    namespace Appeon.ApiDoc.ModelSqlBuilderExamples
    {
        public class GetQueryBuilderExample
        {
            private readonly SchoolContext _context;
    
            public GetQueryBuilderExample(SchoolContext context)
            {
                _context = context;
            }
    
            public void Example()
            {
                ModelSqlBuilder build;
    
                // Creates a ModelSqlBuilder object
                build = ModelSqlBuilder.GetBuilder<CourseInfo>(_context);
    
                var query = build.GetQueryBuilder("SelectCourse");
            }
        }
    }
    

    Example Refer To

    Model Class: CourseInfo

    Applies to

    .NET Standard

    2.x

    See Also

    ModelSqlBuilder.QueryBuilder

    Back to top Generated by Appeon