I read an article by Rick Thrall article about how to solve the data context. My DBML is inside a class library, I keep my data context open by creating a static Current method in a separate private class in the library.
public partial class DataContext
{
public static DataContext Current
{
get
{
DataContext dc = HttpContext.Current.Items["dc"] as DataContext;
if (dc == null)
{
dc = new ImmediacyPageDataContext();
HttpContext.Current.Items["dc"] = dc;
}
return dc;
}
}
then refer to it as follows
DataContext dc = DataContext.Current;
However, this causes problems when I update my DBML file. After editing a DBML file, whenever I try to build a project, my designer file does not regenerate / delete. If I try to launch the custom tool option, it will return with an error.
, , - , , . , .. .
, DBML DC ?