SqlServerDataContextOptions.SqlServerDataContextOptions(string connectionString) Constructor
.NET Standard 2.x
Initializes a new instance of the SqlServerDataContextOptions class by passing the connection string as a parameter.
Namespace: SnapObjects.Data.SqlServer
Assembly: SnapObjects.Data.SqlServer.dll
Syntax
public SqlServerDataContextOptions(string connectionString) : base(DatabaseType.SqlServer)
Parameters
connectionString
System.String
A string containing connection information about how to connect to the data source.
Examples
The following code example uses a connection string to initialize an instance of the SqlServerDataContextOptions
class.
using Appeon.ApiDoc.Models;
using SnapObjects.Data;
using SnapObjects.Data.SqlServer;
using System;
namespace Appeon.ApiDoc.SqlServerDataContextOptionsExamples
{
public class SqlServerDataContextOptionsExample
{
public void Example()
{
var options = new SqlServerDataContextOptions(CONNECTION_STRING);
var dataContext = new SqlServerDataContext(options);
Console.WriteLine(dataContext.ContextOptions.DatabaseType);
/*This code produces the following output:
SqlServer
*/
}
}
}
Applies to
.NET Standard
2.x