This is a migrated thread and some comments may be shown as answers.

Web ObjectScope option

2 Answers 65 Views
Feature Requests
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 07 Dec 2009, 11:20 AM
Referencing this article:
http://www.telerik.com/support/kb/orm/general/best-practices-two.aspx

Can we have an option when generating the ObjectScopeProvider to include this in the generated class?
public static IObjectScope GetPerRequestScope(HttpContext context) 
        { 
            string key = HttpContext.Current.GetHashCode().ToString("x") + Thread.CurrentContext.ContextID.ToString(); 
            IObjectScope scope; 
            if (context == null
            { 
                scope = ObjectScopeProvider1.GetNewObjectScope(); 
            } 
            else 
            { 
                scope = (IObjectScope)context.Items[key]; 
                if (scope == null
                { 
                    scope = ObjectScopeProvider1.GetNewObjectScope(); 
                    context.Items[key] = scope; 
                } 
            } 
            return scope; 
        } 

Possibly then if selected, you can choose the masterpage\page to add in the cleanup...or at least give us the code to copy\paste to save time :)
protected void Page_Unload(object sender, EventArgs e) 
    IObjectScope scope = ObjectScopeProvider1.GetPerRequestScope(HttpContext.Current); 
    scope.Dispose();
}










2 Answers, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 10 Dec 2009, 08:55 AM
Hello Steve,

 We will treat this as a feature request. It will be discussed here in our team and we could add some option that will make the generation of ObjectScopeProvider class to use a different template. We will notify you as soon as we make some decision regarding this feature.


Sincerely yours,
Zoran
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Alfred Ortega
Top achievements
Rank 2
answered on 26 Feb 2010, 09:51 PM
Since many applications will not be used in a web environment could you instead make it an extension method in some new class (Telerik.OpenAccess.Web.ExtensionLibrary)  This way it is available for all your web apps but not an option for others?

Al
Tags
Feature Requests
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Zoran
Telerik team
Alfred Ortega
Top achievements
Rank 2
Share this question
or