Creating WCF DataService with database other than SQL Server - wcf

We would like to expose data we have residing in a Vertica database via the WCF Data Services. (Ultimately, we want to access the data in Excel's pivot tables features, and I've created an Excel Workbook project in Visual Studio to consume this data).
While I can access the Verica data in server code using the ADO.NET provider from Vertica -- I cannot find anywhere to get the WFC DataService code to use a different provider.
Do you know how I can create a WCF data service using a database that is not SQL Server?

Basically WCF Data Services exposes anything that implements the IQueryable interface (for read operations) or the IUpdatable interface in addition, if you want to update/insert data.
Both those interfaces are "wrapped" into yet another layer of interfaces (IDataServiceQueryProvider and IDataServiceUpdateProvider) - but in the end, that's what your data source needs to
Entity Framework or Linq-to-SQL both support those interfaces on their data/object context classes - so you can easily expose them using WCF Data Services.
For more information:
MSDN docs on custom WCF Data Service providers
Using WCF Data Services with custom data source

Related

LDAP (JNDI) backed data service in wso2 data services server

We'd like to create services in WSO2's DSS that query LDAP data. The Data Services Server gives the option of creating JNDI backed data sources, but the data query definition seems to assume that all JNDI data sources use SQL (as evident by the query field being labled SQL).
The old WSO2 forums suggest that it's possible... http://wso2.com/forum/thread/11109
Does anyone have an example?
thx
Liam
As far as I know you cannot use JNDI to expose LDAP data as LDAP doesn't expose its data as a database .. If you want samples on JNDI Data Sources and Exposing Data Sources as JNDI Resources, Please refer 1 and 2. If you want to expose your LDAP data and create data services you can use Data services custom data source feature and implement it.

Examples of WCF CRUD operations for Oracle?

I'm working on exposing access to an Oracle database table for a SharePoint implementation.
From what I've seen, Oracle is not directly supported by BDC, so I'm trying to write a WCF service to perform the CRUD operations against my table.
I've been researching on Google with very limited success. Can anybody point me to an example of using WCF to modify data in an Oracle database?
I was able to figure this out by following this tutorial (leaving out the Silverlight stuff since I didn't need Silverlight)
How to connect to Oracle database using WCF in Silverlight

How to pass data using Entity Framework and wcf

I'm trying to develop a .net4 application  using c#, wcf and entity framework. My first idea was to pass the EF generated objects through wcf (first with the default entity objects, then with the POCO entities), but I soon got several connection problems (connection is closed) due to non serializable objects in the generated entities. I ended up writing several data-only classes to host the data queried with EF, but now I miss the role of the EF with WCF. I guess I'm doing something wrong, so how do you send data through wcf using EF? What is the point of EF? Wouldn't it be easier to write stored procs and standard ado.net...?
Entity Framework is just a data access technology. You can create a data access layer which talks to your database and return the required data using Entity framework and then plug that to your WCF service so that your WCF service will get the data. You can use the same data access layer with any other consumers ( a Silver light application, A Windows form project or an MVC application). The advantage of using Entity framework is that it will load the data to your domain objects (your POCO classes) so that you do not need to do it manually yourself. In the case of Stored proc, you need to execute the stored proc, Iterate thru the DataReader/ DataTable the fill your objects. For this you have to write code. If you use Entity framework, EF does this for you so you can save some dev time.
You should clearly logically seperate your project so that there will be a data access and a consumer which consumes the Data Acccess layer( your WCF service).

EF4.x and WCF Service (Persistence ignorant) Updating nested entities with 1 to n and m to n relationship.

I have SQL Server database and would like to use LINQ to Entities and wrap it with WCF layer and expose it to client. (typical N-Tier architecture). ALso would like to have Persistence ignorant option and also would like to have an option ignore certain fields (sensitive information) in database from serializing it to client.
So what would be best approach for using Entity Framework with Persistence Ignorance, Self Tracking with WCF Support. I could find T4 template with either Self Tracking or Persistence Ignorant.. But everything bundled as single package.
Any help in this would be greatly appreciated.
STEs don't allow any projections - you must expose your entities in their exact form. If you want to hide some fields you must abandon STEs and create your own DTOs (data transfer objects) exposing only subset of your entities data. Once you use DTOs you must manually handle all change tracking.

Querying database from different applications with nHibernate

In this moment, I have two web applications(one application is an MVC2 application for the management of my project and the second is an application with web services). Both applications have to deal with the database and have Nhibernate for querying the database. Is this a good pattern?, if not what can i do?
Edit 1
Both applications can write to the database. I have a dll project that handle the database transactions and have de nhibernate instance named "Repositorio". Nevertheless, each application will have a different instance of Repositorio.dll so there is going to be multiple threats to the database, what do i have to do to make both application use the same instance of Repositorio.dll?
The answer depends on whether or not both applications can write to the database.
If one is read-only, I'd say you're safe.
I not, I'd argue that a service-oriented approach would recommend creating a service that provided an interface for both applications and was the sole owner of the database.
"service-oriented" does not mean that the service has to be a distributed component (e.g., SOAP or REST or RPC). If you encapsulate the database access in a component with a well-defined interface you can choose to share the component as a DLL in both applications. Only make it a distributed component if that makes sense for both applications.
That sounds perfectly fine to me even if both applications write to the database. I would simply recommend you create a third project as a class library with all your nHibernate related stuff to avoid writing any redundant code in both projects.