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: {
this is what i get if i implement such class:
partial class db
{
static db _db = new db();
public static db GetInstance()
{
return _db;
}
}
db is a linq2sql datacontext
why this hapenned and how to solve this?
UPD: that file is generated by linq2sql:
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
public db() :
base(global::data.Properties.Settings.Default.nanocrmConnectionString, mappingSource)
{
OnCreated();
}
if I instantiate db inside method (not property like here) all works fine. and the static method worked until this morning, but now even 2 days ago version (restored from repository) falls with the same error.
UPD 2:
so this is my partial class after problem was solved:
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;
}
}
}