Show / Hide Table of Contents

    SqlBuilderFactory.Create<TSqlBuilder>(string name = "") Method

    .NET Standard 2.x

    Creates an TSqlBuilder type object, TSqlBuilder is the derived interface of ISqlBuilder

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

      public static TSqlBuilder Create<TSqlBuilder>(string name = "");
    

    Type Parameters

    TSqlBuilder

    The type of interface which is inherited from the ISqlBuilder interface.

    Such as ISqlQueryBuilder, ISqlInsertBuilder, ISqlDeleteBuilder, ISqlUpdateBuilder, and ISqlRawBuilder.

    Parameters

    name System.String

    The name of the newly created ISqlBuilder object.

    Returns

    TSqlBuilder

    Returns the newly created TSqlBuilder object.

    Examples

    The following code example demonstrates how to create a ISqlQueryBuilder object.

    using SnapObjects.Data;
    
    namespace Appeon.ApiDoc.SqlBuilderFactoryExamples
    {
        public class CreateExample
        {
            private readonly SchoolContext _context;
    
            public CreateExample(SchoolContext dataContext)
            {
                // Sets data context
                _context = dataContext;
            }
    
            public void Example()
            {
    
                // Creates a ISqlQueryBuilder object.
                var query = SqlBuilderFactory.Create<ISqlQueryBuilder>();
    
                // Builds the SQL query using the ISqlQueryBuilder object.
                query.Select("name")
                    .From("Department")
                    .Where("departmentid", "c.departmentid");
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon