Note that there are some explanatory texts on larger screens.

plurals
  1. POOData WCF Data Service with NHibernate and corporate business logic
    primarykey
    data
    text
    <p>Let me first apologise for the length of the entire topic. It will be fairly long, but I wish to be sure that the message comes over clearly without errors.</p> <p>Here at the company, we have an existing ASP.NET WebApplication. Written in C# ASP.NET on the .NET Framework 3.5 SP1. Some time ago an initial API was developed for this web application using WCF and SOAP to allow external parties to communicate with the application without relying on the browsers.</p> <p>This API survived for some time, but eventually the request came to create a new API that was RESTfull and relying on new technologies. I was given this assignment, and I created the initial API using the Microsoft MVC 2 Framework, running inside our ASP.NET WebApplication. This took initially quiet some time to get it properly running, but at the moment we're able to make REST calls on the application to receive XML detailing our resources.</p> <p>I've attended a Microsoft WebCamp, and I was immediatly sold by the OData concept. It was very similar then what we are doing, but this was a protocol supported by more players instead of our own implementation. Currently I'm working on a PoC (Proof of Concept) to recreate the API that I developed using the OData protocol and the WCF DataService technology.</p> <p>After searching the Internet for getting NHibernate 2 to work with the Data Services, I succeeded in creating a ReadOnly version of the API that allows us to read out the entities from the internal business layer by mapping the incoming query requests to our Business layer. However, we wish to have a functional API that also allows the creation of entities using the OData protocol. So now i'm a bit stuck on how to proceed. I've been reading the following article : <a href="http://weblogs.asp.net/cibrax/default.aspx?PageIndex=3" rel="noreferrer">http://weblogs.asp.net/cibrax/default.aspx?PageIndex=3</a></p> <p>The above articly nicely explains on how to map a custom DataService to the NHibernate layer. I've used this as a base to continue on, but I have the "problem" that I don't want to map my requests directly to the database using NHibernate, but I wish to map them to our Business layer (a seperate DLL) that performs a large batch of checks, constraints and updates based upon accessrights, privledges and triggers.</p> <p>So what I want to ask, I for example create my own NhibernateContext class as in the above articly, but instead rely on our Business Layer instead of NHibernate sessions, could it work? I'd probably have to rely on reflection alot to figure out the type of object I'm working with at runtime and call the correct business classes to perform the updates and deletes.</p> <p>To demonstrate with a smal ascii picture:</p> <pre><code> *-----------------* * Database * *-----------------* *------------------------* * DAL(Data Access Layer) * *------------------------* *------------------------* * BUL (Bussiness Layer) * *------------------------* *---------------* *-------------------* * My OData stuff* * Internal API * *---------------* *-------------------* *------------------* * Web Application * *------------------* </code></pre> <p>So, would this work, or would the performance make it useless? Or am I just missing the ball here? The idea is that I wish to reuse whatever logic is stored in the BUL &amp; DAL layer from the OData WCF DataService.</p> <p>I was thinking about creating new classes that inherit from the EntityModel classes in the Data.Services namespace and create a new DataService object that marks all calls to the BUL &amp; DAL &amp; API layers. I'm however not sure where/who to intercept the requests for creating and deleting resources.</p> <p>I hope it's a bit clear what I'm trying to explain, and I hope someone can help me on this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload