SqlServerDataContext.SqlServerDataContext(IDataContextOptions dataContextOptions) Constructor
.NET Standard 2.x
Initializes a new instance of the SqlServerDataContext class by passing the SqlServerDataContextOptions type object as a parameter.
Namespace: SnapObjects.Data.SqlServer
Assembly: SnapObjects.Data.SqlServer.dll
Syntax
public SqlServerDataContext(IDataContextOptions dataContextOptions) : base(dataContextOptions)
Parameters
dataContextOptions
SnapObjects.Data.IDataContextOptions
The options to be set for the DataContext
object.
Examples
The following code example uses a SqlServerDataContextOptions
object to initialize an instance of the SqlServerDataContext
class.
using Appeon.ApiDoc.Models;
using SqlServer.ManagedDataAccess.Client;
using SnapObjects.Data;
using SnapObjects.Data.SqlServer;
using System;
namespace Appeon.ApiDoc.SqlServerDataContextExamples
{
public class SqlServerDataContextExample
{
public void Example1()
{
var dataContext = new SqlServerDataContext(new SqlServerDataContextOptions(CONNECTION_STRING));
Console.WriteLine(dataContext.ContextOptions.DatabaseType);
/*This code produces the following output:
SqlServer
*/
}
}
}
Applies to
.NET Standard
2.x