Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: mapping
Source Error:
Line 45: #endregion
Line 46:
Line 47: public db() :
Line 48: base(global::data.Properties.Settings.Default.nanocrmConnectionString, mappingSource)
Line 49: {
これは、そのようなクラスを実装すると得られるものです:
partial class db
{
static db _db = new db();
public static db GetInstance()
{
return _db;
}
}
db は linq2sql データコンテキストです
なぜこれが起こったのか、これを解決する方法は?
UPD : そのファイルは linq2sql によって生成されます:
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
public db() :
base(global::data.Properties.Settings.Default.nanocrmConnectionString, mappingSource)
{
OnCreated();
}
メソッド内でdbをインスタンス化すると(ここのようなプロパティではありません)、すべて正常に動作します。静的メソッドは今朝まで機能していましたが、2 日前のバージョン (リポジトリから復元されたもの) でも同じエラーが発生します。
更新 2 :
これは、問題が解決された後の私の部分クラスです。
namespace data
{
using System.Data.Linq.Mapping;
partial class db
{
static db _db = new db(global::data.Properties.Settings.Default.nanocrmConnectionString, new AttributeMappingSource());
public static db GetInstance()
{
return _db;
}
}
}