n-Tier with WFC

14 posts, 0 answers
  1. Brandon
    Brandon avatar
    20 posts
    Member since:
    Nov 2007

    Posted 09 Nov 2008 Link to this post

    While I am not a novice developer, I am somewhat of a novice C# developer.  I am interested in developing a WinForms application that communicates with a remote MS SQL Server via the Internet.  From what I have read, the best way to accomplish this is to use Windows Communication Foundations.  I am very interested in using the TCP/IP transport with compression.  I also really like OpenAccess and would like to use that technology in my application.

    Reading through the documentation, I noticed that OpenAccess can work with n-Tier applications.  What I cannot seem to find is any information on how to use OpenAccess to retrieve information using WCF as the communication mechanism.  I imagine this mechanism working as follows (Please correct me if I am wrong):

    1. The WinForms client connects to WCF service and requests a list of customers
    2. The WCF service retrieves a list of persistent objects from the database using OpenAccess
    3. The WCF service then somehow streams those objects to the WinForms client
    4. The WinForms client manipulates the data
    5. The WinForms client then somehow streams any changes back to the WCF service
    6. The WCF service then commits those changes to the database

    First, is this a possible solution in C#?  Second, does anybody know of any good source that I can use to learn more about this type of development?  Thank you in advance.

    Brandon Rock
  2. Brandon
    Brandon avatar
    20 posts
    Member since:
    Nov 2007

    Posted 09 Nov 2008 Link to this post

    I found my answer in the help file under the chapter entitled "The OpenAccess ORM Disconnected API."  It states the following:

    "The complete object container can be serialized to export the content into a file or to send it over a network connection to another application. This byte- or XML-stream can be used to fill a new container object. All persistent object states are serialized with the container—nothing gets lost."
  3. DevCraft banner
  4. Paul Gates
    Paul Gates avatar
    12 posts
    Member since:
    Apr 2004

    Posted 10 Nov 2008 Link to this post

    I'd too like to hear from Telerik how to implement an ntier solution with WCF and Silverlight at the top end.

    P.
  5. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 11 Nov 2008 Link to this post

    Hello Paul Gates,

    We are working on a Silverlight example, please stay tuned.

    All the best,
    Jan Blessenohl
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Softec
    Softec avatar
    45 posts
    Member since:
    Sep 2007

    Posted 12 Nov 2008 Link to this post

    HI

    Can you also provide us a example how to use ObjectProvider without a WebService. (perhaps using net.tcp binding).

    In your demo on "http://demos.telerik.com/orm/Examples/ObjectContainer/DefaultCS.aspx" it seems that ObjectProvider only handles objects from a single "table". Is that right?

    How about using linq on client side? Without having an ObjectScope?

    Greets
  7. Andrea
    Andrea avatar
    64 posts
    Member since:
    Jan 2005

    Posted 14 Nov 2008 Link to this post

    I'm interested on this approach too.

    I'm implementing an enterprise solution where WCF must talk with Silverlight, ASP.NET AJAX and WPF.. but now I'm searching for a valid ORM tool... I'm tired of make DALs


    Regards.
  8. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 15 Nov 2008 Link to this post

    Hello Andrea,

    Whenever you think about a n-tier application the challenge is the data transport. You can use the WCF, Webservice or whatever mechanisms to transport your data. That means that the OpenAccess session does not no about this data anymore. Whatever you do on the client side you have to track all the changes and send them back to the application server.

    At this point OpenAccess comes back in place. There is a class ObjectNetworkAttacher that can register your data again in the ObjectScope. The class comes in source code and is in the src dir of the product.

    What you do on the client side is not longer OpenAccess dependent. The objects are now normal .NET objects. ObjectView, ObjectProvider or OpenAccessDataSource will not work anymore. You have to use object binding.

    If you think about using the ObjectContainer it is different. The container tunnels a bag of data through your communication channel and behaves like the scope on the front tier. You can fill the container with all kinds of data and work with him like with the scope.

    Regards,
    Jan Blessenohl
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. k f
    k f avatar
    109 posts
    Member since:
    Jun 2006

    Posted 18 Nov 2008 Link to this post

    Brandon,

    If you are going to use WCF, I suggest you take a look at the MS SOA patterns.  My recommendation to you would not be to try and pass the objects returned by your DAL.  I might suggest you look at creating your own DTO objects and then make use of assemblers to convert the data from the ORM objects of your choice into your own DTO objects.  This gives you a more elegant solution that allows you to more loosely couple your BLL with your DAL.  So down the road no matter what ORM you are using, you can transition to an alternative much easier.

    With the use of macros and copying and paste, not that much more work.

    Personally I go ahead and also have data access objects for my service implementaiton layer to where the objects in those two layers are loosely coupled as well.

    May be over kill but this way also you don't have to worry about the serialization of third party products because you can design and use your own objects in your contracts.

  10. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 24 Nov 2008 Link to this post

    Hello Kris,

    More freedom to the persistent objects.

    I am personally not a fan of keeping the persistent objects in the DAL. If you think about former times where you did the mapping by hand you did copy the data into your Business Objects. And it was possible to send this business objects around.

    We are now doing the data handling for you, but for me the persistent objects should be handled like business objects. You can wrap everything but you do not have to.

    Greetings,
    Jan Blessenohl
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  11. k f
    k f avatar
    109 posts
    Member since:
    Jun 2006

    Posted 24 Nov 2008 Link to this post

    Hello Jan,

    I'm not sure I understand your postion?  You use your product or any ORM, you still have to go in and build the entities and use those entities in your WCF services.  Although the build process is automated in ORM cases.

    The db changes and you still have to update unless you are tying in directly to sprocs but for me that would kind of defeat the purpose somewhat of using an ORM if you plan to only rely on sprocs.

    In doing so you're tightly coupled to your product or anybody elses you use.  I find out down the road that the ORM I'm using has severe shortcomings and I want to change.  It would be a mess if you just relied on using the ORM's entities directly.

    Again, I'm not saying anybody has to do it this way but I don't like coupling layers and especially when it comes to relying on 3rd party products.

    Also, a comment about your OA, I just ran the wizard against a database only to find that it litters up my config file with what seems like every entity of the database.  Extremely turned off by the clutter it causes and will probably stick with the ORM I have.

  12. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 24 Nov 2008 Link to this post

    Hi Kris,

    You are right, you have to decide it from project to project. I just want to avoid that everybody uses wrapper for everything.

    We are only writing mapping information to the projects config file for the tables that you did reverse engineer, but you can move that to your own file and pass it to OpenAccess in the database open call. If you talk about the reversemapping.config file, this is not used during runtime, it just contains the information to reopen the dialog in the same stage as before and makes it possible to merge the schema changes into the actual mapping.

    All the best,
    Jan Blessenohl
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  13. Andrea
    Andrea avatar
    64 posts
    Member since:
    Jan 2005

    Posted 26 Feb 2009 Link to this post

    Any news about the n-Tier WFC/Silverlight example application?

    Regards
  14. k f
    k f avatar
    109 posts
    Member since:
    Jun 2006

    Posted 26 Feb 2009 Link to this post

    Andrea,

    To my knowledge there isn't much difference in connected from Silverlight than a regular Asp.Net page.  I think you may need to set an ASPNetCompatibility flag on your service endpoints.  From the silverlight application from what I understand you need to make asyncrhonous calls.  The service config utility will automatically setup the asynchronous calls.

    I've just started looking at Silverlight and I have Northwind WCF example that I plan as time permits to create a silverlight front end into it as well.  http://demo.n-sv.com/NWUI

  15. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 28 Feb 2009 Link to this post

    Hello k f,
    Yes we are currently working on preparing the same setup with Telerik OpenAccess ORM tool.

    All the best,
    Dimitar Kapitanov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
DevCraft banner