Migrate a C1 website's data store from XML to SQL
Migrating a website from an XML-based data store type to an SQL Server-based data store typically takes a few minutes after which the site is fully operational.
Background
Because Composite C1 has data logic captured in .NET LINQ rather than specific SQL statements or XML queries and because data schemas are defined as CLR types (interfaces) rather than XSD schemas or SQL schemas, the migration typically requires no code changes at all.
When Composite C1 is running on XML, the features of "LINQ to XML" are utilized to query the XML files, and data is stored in element attributes. When Composite C1 is running on an SQL Server, the features and performance of "LINQ to SQL" are utilized and data is stored in structured and typed tables.
Important Notes
- For Composite C1 versions earlier than 3.0 only: To avoid errors of the missing assembly "Microsoft.SqlServer.Smo, Version=10.0.0.0", please install Microsoft SQL Server 2008 R2 Shared Management Objects (SMO) on the server where Composite C1 is running.
How to implement
The following is the scenario for migrating an XML-based C1 website to Microsoft SQL Server. You should make a backup of your solution before you do this.
- Create an empty database on Microsoft SQL Server (e.g. "DemоDB"). (It will be used for the connection string in Step 6).
- Create a user with the DBO access to this database. (It will be used for the connection string in Step 6).
- Install the Composite.Tools.SqlServerDataProvider package.
- After the console has reloaded, switch to the System perspective.
- Select SqlServer Data Provider and click Convert to SQL on the toolbar.
- In the wizard, specify the connection string (e.g. "Data Source=.\SQLEXPRESS;Database=DemoDB;Integrated Security=True;" or "Data Source=.\SQLEXPRESS;Database=DemoDB;User Id=user;Password=password;"), click Next and wait until C1 finishes validation
- In the next step, click Finish and wait for SQL Server Data Provider to complete the migration.
- Click OK in the "Data Store migration completed".
The C1 administrative console will reload.
Now your website runs on an SQL Server database.
Requirements
Composite C1 2.1 or later