Q1 2010 Confusion - How to Seperate DAL and Web App

5 posts, 0 answers
  1. Bill Murphy
    Bill Murphy avatar
    3 posts
    Member since:
    Mar 2010

    Posted 30 Mar 2010 Link to this post

    I had been testing out the previous Q3 2009 release when I saw this version has come out.  I had started a project and created a class file and added the .rlinq into it.  I added a reference to this class in the ASP.NET website and am trying to comprehend how to use and bind to the objects in this class from the Web project.

    Do we still Enable the Web Project to use ORM as in the Q3 2009 release and follow the same guidelines from there? From the limited information I have been able to find, it seems that I am missing something here.  Can you provide a simple example of how to referece the EntityDiagrams from a web application and how to use that to databind to say a RadGrid? 

    Also - in a web application when I use the new method to add ORM to it, the openaccess data source is not working properly.  It says the project is not enabled and to enable and recompile it first.  I have tried to find specific documenation on using the new methods but feel like I am banging my head against a wall. 

    I know it has to be simple - but maybe I am so used to the "old way" of doing things that was in the previous documentation that something isn't clicking with me.  Any guidance appreciated - even point me to downloads and examples or docs on the new methods that would be fine.

    Thanks for anyone who can help!

    - Bill
  2. Bill Murphy
    Bill Murphy avatar
    3 posts
    Member since:
    Mar 2010

    Posted 30 Mar 2010 Link to this post

    It would appear at this time, there are no design time Datasources for use when using the new Visual Designer and the Generated Entity Contexts - would that be correct?  In addition in order to use the DAL class in a Web App (or I am guessing in any other app) I can reference my Project with the Data Classes in them such as MyData and then create a new context by using something along these lines in the Page_Load section of a page (sample just loads a RadGrid:

            using (MyData.MyDataEntityDiagrams db = new MyData.MyDataEntityDiagrams("MyDataConnectionString")) 
            { 
                var results = from p in db.Propertyaddresses select p; 
                RadGrid1.DataSource = results
                RadGrid1.Columns.Clear(); 
                RadGrid1.AutoGenerateColumns = true
                RadGrid1.DataBind(); 
            } 

    In the above code, I am trying to wrap my head around how this compares to the other methods that I had been learning to use with OA and the scope management.  Is all that kind of gone more in the favor of a Linq2SQL style of managing objects and Data Access?  What design time databinding options do we have?  I am assuming then that to avoid passing any connection string inside the web app that I would need to create a WCF service to hand off the data and handle the request from the web app to the DAL - would that then also be correct? 

    How then do I handle the objects from the ORM side through the WCF - I am guessing I reference the Persistent Objects (DAL) class and pass the DataContext and Objects back and forth - trying to work on that now.

    Please forgive me as I am trying to learn as quickly as possible and am just full of questions and not a lot of answers.  Again if this is in the docs somewhere or there are resources I need to look at, please let me at them - but I have failed to locate anything as of this time.
  3. DevCraft banner
  4. Serge
    Admin
    Serge avatar
    375 posts

    Posted 31 Mar 2010 Link to this post

    Hello Bill,

    You are correct, at this point you cannot use the OpenAccessDataSource with the new OpenAccess version as now we do not generate the required ObjectScopeProvider class. This is just temporary though, the reason for not having this functionality is that we did not have the time to develop it for the Q1 release. Nevertheless, we will make the required improvements very soon so the OpenAccessDataSource works with the new "context" class. This will be available in the soon-to-come service pack release.

    Regarding the context/scope management question, I can tell you that the rules basically apply for both objects e.g. the best practices that you have probably read about scope management also apply for the context. It is just a different API that will expose much more functionality as the time goes by(integration with WCF services, RIA services etc..). It also targeted mostly for customers that have previously used Linq To SQL so they meet a familiar API that cuts the learning curve with OpenAccess.

    The persistent classes are not designed for serializing and passing through the wire so it is not recommended to used them directly for WCF calls. The preferred approach for now is to use proxy objects that would transport your data.  If you are determined to use WCF, you can review this solution. It should give you some pointers but bear in mind that it is built using an older OpenAccess version, that is through the old wizards. Nevertheless the proxy objects approach is shown in a working scenario which should be enough for you to move ahead using the new version as well.

    Please do not hesitate to contact us if you need any more questions or suggestions for us.

    Regards,
    Serge
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Christian
    Christian avatar
    81 posts
    Member since:
    Aug 2008

    Posted 04 Jun 2010 Link to this post

    Hello,
    I use the OR-Mapper in existing web projects.
    Now I am a little confused. My question: Is the function in the current version available again? If not: When can I expect to function? What to do with existing projects following an update of the OR-Mapper?

    Thanks.
    Christian
  6. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 07 Jun 2010 Link to this post

    Hi Christian,

    I am happy to let you know that the service pack release that we did the previous week contains a new version of the OpenAccess data source control for web. This new version is now working fine with the new context (that is generated by the visual designer). I strongly suggest that you download and try the latest version of OpenAccess ORM.
    Do not hesitate to write again if you have more questions.

    Best wishes,
    Jordan
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
DevCraft banner