Last days i tried to build working DO4 provider for interlinq. Now i have working DataObjects.NET provider to be used with InterLINQ framework to transfer linq queries agains DO4 through WCF services. My main goal is to have some "client" library which does NOT reference any of DO4 libs (xtensive.*) and no DO model library, where you define your model entities classes. Just make some lightweight library with Dto class as opposite to real model entity classes, which will be mapped to real entity classes on wcf server side by O2O mapping features in latest DO4. I want this "lightweight library" specially for SL applications to not bring too much references to external libraries (to reduce server->client transfer size).

Attached solution contains these projects:

  • InterLinq.DataObjects (C# library)

Contains class DataObjectsQueryHandler which implements one important interface from InterLINQ - IQueryHandler and is responsible for all magic about translating linq quries on Dto classes (on client side) into linq queries on Entity classes (on server side) and return back IQueryable list of Dto objects as an result of O2O mapping made on server

This library is referenced only on server side, not on client side

  • Interlinq.DataObjects.Common (C# library)

Contains class DataContext which is inherited from InterLINQ class InterLinqContext and is responsible for making linq quries on client side. Also contains simple Dto objects which are clones of real entity classes from entity model project, which will be used on client side in linq quries

This library is referenced on server side and client side

-InterLinq.DataObjects.Test.Model (C# library)

Contains entity model classes derived from DO4 base class Entity

This library is referenced only on server side, not on client side

  • InterLinq.DataObjects.Test.Server (C# console application)

Starts wcf service, instanting DataObjectsQueryHandler (IQueryHandler), and important one it creates mapping description of Dto classes and Entity classes. Also populate some test initial data.

This application references: InterLinq, InterLinq.DataObjects, Interlinq.DataObjects.Common, InterLinq.DataObjects.Test.Model (also others not important now)

  • InterLinq.DataObjects.Test.Client (C# console application)

Creates connection to wcf service using DataContext and queries for data using linq queries on Dto objects

This application references: InterLinq, Interlinq.DataObjects.Common (also others not important now)

Note: sample is not optimized, e.g. cached MethodInfo objects gets by reflection and other things. It was made as try it if DO4 can work with InterLINQ. Will make optimization later, if this sample will be usefull for somebody (or for me).


Updated at 10.03.2010 12:49:16

I made some "radical" changes within method Get<t> in class DataObjectsQueryHandler according to some comments from Alex Yukanin, to build up better projection on server side.

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Mar 09 '10 at 14:46

Peter%20%C5%A0ulek's gravatar image

Peter Ĺ ulek
492313236

I'll check the new version today - have no time to do this right now.

(Mar 09 '10 at 14:46) Alex Yakunin Alex%20Yakunin's gravatar image
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×574

Asked: Mar 09 '10 at 14:46

Seen: 10,240 times

Last updated: Mar 09 '10 at 14:46

powered by OSQA