When using ORM, should always keep in mind that only one object scope is used. The example came with the package doesn't really explain this well. Should always declare a page_init call which declares the object scope and store it in session and try to keep using it for any business operations:
private IObjectScope cachedScope;
protected void Page_Init(object sender, EventArgs e) {
if (this.Session["objectScope"] != null) {
cachedScope = (IObjectScope)this.Session["objectScope"];
} else {
cachedScope = ObjectScopeProvider.GetNewObjectScope();
this.Session["objectScope"] = cachedScope;
}
}
There's one good example here: http://www.telerik.com/community/code-library/orm/general/best-practices-in-web-development-with-openaccess.aspx
If you think this post is useful, please recommend me at the bottom of the page. ;)