Data in Composite C1

Topics: General
May 30, 2011 at 8:41 PM

I am trying to integrate my database with Composite C1 and have followed the directions for reading SQL Data as outlined at http://docs.composite.net/C1/Data/CustomDataProviders/ReadingSqlServerData.aspx.  This article only describes how to expose tables that are related and use LINQ to access data from Composite C1.  Ideally I would liked to use Stored procedures that I have created.   The store procedures also take parameters.  Is this possible in Composite C1.

May 31, 2011 at 7:31 AM

To clarify, you want to expose your custom database into C1 using IDataProvider. Is this correct? I ask because you can also add a C1 function that calls the stored procedure and returns XML (Another way of getting your data into C1).

Assumed that you want to use the IDataProvider method. There is no direct way of doing this calling stored procuderes. The easy, but not performing way is: Execute stored procedure and "convert" the result into a IQueryable and use this in your custom IDataProvider implementation.

If want more performance, then I think you have to parse the linq expression tree, extract what every information you can use to parse on to your stored procedure. This involves creating your own IQueryable implementation and returning this in your IDataProvider implementation.

More on LINQ to stored procedures: http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx

Custom IQueribale implementation: http://blogs.msdn.com/b/tommer/archive/2007/04/20/building-custom-linq-enabled-data-providers-using-iqueryable-t.aspx or one of C1s implementations: http://compositec1.codeplex.com/SourceControl/changeset/view/7427#42629

Hope this helps!

/Martin

May 31, 2011 at 3:00 PM

Thanks for the response.  Looks like implementing a C1 Function to call stored procedure will be the best option.   Is their any good documentation or samples to clarify this.  I am qute familiar with linq to stored procedures..