You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
632 B
C#

using LinqToDB;
using System;
using System.Configuration;
namespace TradeUsedSale.Repositories.Utils
{
internal class LinqToDbExtensions
{
private const string ConnectionStringKey = "ConnectionString";
public static DataOptions GetOptions()
{
var connection = ConfigurationManager.AppSettings[ConnectionStringKey];
if (string.IsNullOrEmpty(connection))
{
throw new Exception($"未找到Web.config中Key为 '{ConnectionStringKey}' 的配置项");
}
return new DataOptions().UseSqlServer(connection);
}
}
}