Using SQL

Topics: General, MVC, Standard packages, Troubleshooting
Apr 5, 2011 at 7:02 PM

Hi,

I a new to Composite and was wondering if there is documentation on how to use SQL in the backend to update SQL databases.

Right now we created stored procedures to add, delete, update records and we have in the past creates our own backend... Is there an easy way to do this in composite?  Also, is there documentation as to how to display SQL data from a storeconvey2webd procedure?

I have been able to create an SQL Connection and get data to display in the test window, but I am not sure where to go from here.

 

Thanks 

Coordinator
Apr 5, 2011 at 8:22 PM

Composite C1 and SQL

Composite C1 can run of SQL Server - there is a package which will migrate you from the default setup (data kept in mem, stored in XML files) to SQL Server. You need to run Composite C1 2.1 to migrate to SQL Server. The migration process takes a few minutes and very seldom require any code modifications. The package to install is described here: http://docs.composite.net/C1/Packages/CompositeC1Tools/SQLServerDataProvider.aspx

When you create new data types in Composite C1 either using the C1 Console visual tool or you define data types using code the physical store the types end up as neat sql tables (when running on sql).

Composite C1 has a LINQ centric / CLR type oriented data layer - meaning that you can do your querying, projections, ordering, paging, etc. using .NET LINQ and Composite C1 will transform this to SQL for you. As such, you need not write Stored Procedures, DALs etc.You can read about the data API Composite.Data. A general intro to CRUD via the API is here: http://docs.composite.net/C1/Data/AccessingDataWithCSharp.aspx

You can 'import' your own existing SQL data by writing a provider - see http://docs.composite.net/C1/Data/CustomDataProviders.aspx - once your data is exposed this way it will be 'family' and all the tools in Composite C1 will work with it, like regular Composite C1 data types.

Embedding your own code that talk with a SQL Server, front-end

If you don't need the Composite C1 bits mixed into your task, but just need to expose7updata data from the website front-end, then just "code as you like". You probably have your web UI defined as Web Forms or MVC and you embed that on you Composite C1 pages. See http://docs.composite.net/C1/ASP-NET.aspx

Embedding your own code that talk with a SQL Server, back-end

If you need write an app that run seamlessly inside the Composite C1 console, which expose some custom tree structure and custom forms, reports etc. and your data is in a custom SQL Server database, you can either create a simple read-only data provider which expose your data, and then use the Tree Definitions feature for tree handling, or you can write a new provider for the tree handling - once you have trees up and running your forms / reports can be done using std. asp.net (web.forms or mvc) or you can use the Workflow Foundation / XAML like tech in Composite C1 for doing wizards, forms etc. See http://docs.composite.net/C1/Console/FormWorkflows.aspx