Evaluating Linq to Sql - have a few questions
Evaluating Linq to Sql - have a few questions
Hello,
The company I am working for will be evaluating some ORM tools in the next few weeks. I have a few questions about your product.
1) If we bought the Professional edition would the Entity Developer be able to be used with the Entity Framework? (Does the professional edition contain the professional edition of the Entity Designer?)
2) I downloaded the trial version of LinqConnect and I don't see how I can use the Entity Designer to modify the edmx file?
The company I am working for will be evaluating some ORM tools in the next few weeks. I have a few questions about your product.
1) If we bought the Professional edition would the Entity Developer be able to be used with the Entity Framework? (Does the professional edition contain the professional edition of the Entity Designer?)
2) I downloaded the trial version of LinqConnect and I don't see how I can use the Entity Designer to modify the edmx file?
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
LinqConnect Professional includes the version of Entity Developer that supports LinqConnect models only (though can be used with different DBMSs).
If you want to work with both LinqConnect and Entity Framework models, you can select one of the following options:
- if you are going to work with SQL Server databases only, you can purchase LinqConnect Standard and Entity Developer for Entity Framework;
- if you want to work with some other database, e.g., Oracle, you can use the Professional edition of the corresponding data provider (e.g., dotConnect for Oracle).
Feel free to contact us if anything is unclear.
If you want to work with both LinqConnect and Entity Framework models, you can select one of the following options:
- if you are going to work with SQL Server databases only, you can purchase LinqConnect Standard and Entity Developer for Entity Framework;
- if you want to work with some other database, e.g., Oracle, you can use the Professional edition of the corresponding data provider (e.g., dotConnect for Oracle).
Feel free to contact us if anything is unclear.
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
We don't plan to implement such functionality in near future. However, you can support this suggestion at our UserVoice:
http://devart.uservoice.com/forums/3867 ... -migration
http://devart.uservoice.com/forums/3867 ... -migration
Hello I have a few more questions.
1) Is there a way to easily remove all rows of data using the conext?
Something like: myContext.Orders.RemoveAllRows()?
2) If multiple people were to install a app that uses LinqConnect and they wanted to have their own unique database names is there someway to do this in code? I thought changing the database name in the Connection object might be the way. But that didn't work in my test.
3) In the scenario in 2....if they wanted to pick what database they wanted to use (MySQL or MS SQL) could that be done in code?
1) Is there a way to easily remove all rows of data using the conext?
Something like: myContext.Orders.RemoveAllRows()?
2) If multiple people were to install a app that uses LinqConnect and they wanted to have their own unique database names is there someway to do this in code? I thought changing the database name in the Connection object might be the way. But that didn't work in my test.
3) In the scenario in 2....if they wanted to pick what database they wanted to use (MySQL or MS SQL) could that be done in code?
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
Concerning your questions:
1) You can use the DeleteAllOnSubmit method to delete multiple rows from the table:
However, this approach will actually result in a single select command and multiple delete commands (one per Order). The reason is that LinqConnect tracks the entity objects and thus should know when a particular entity is deleted.
If you want to clear a table faster, you can use the ExecuteCommand method instead:
2) Generally, it should be sufficient to specify another database in the connection string. However, this supposes that the database name is not stored in the model mapping. To ensure that this is so, ensure that you clear the 'Preserve schema name in storage' check box in the model settings when creating the model (this option is enabled by default).
3) Using the same model with different DBMSs needs different mapping sources. Attribute mapping does not provide such possibility, thus it is necessary to use the file mapping. To implement the scenario you described, it is necessary to create two mapping files (one per DBMS), and switch between them in your application.
Feel free to contact us if anything is unclear.
1) You can use the DeleteAllOnSubmit method to delete multiple rows from the table:
Code: Select all
myContext.Orders.DeleteAllOnSubmit(myContext.Orders);
myContext.SubmitChanges();
If you want to clear a table faster, you can use the ExecuteCommand method instead:
Code: Select all
myContext.ExecuteCommand("delete from \"Orders\"");
3) Using the same model with different DBMSs needs different mapping sources. Attribute mapping does not provide such possibility, thus it is necessary to use the file mapping. To implement the scenario you described, it is necessary to create two mapping files (one per DBMS), and switch between them in your application.
Feel free to contact us if anything is unclear.
Hello,
On number 2 if the lqml file has already been created where can I uncheck the 'Preserve schema name in storage' checkbox?
On #3...Could I possible see some sample code on picking either MySQL or SQLServer in code and then creating a new database that a user selects? Lets say the name is stored in: string newDatabaseName;
On number 2 if the lqml file has already been created where can I uncheck the 'Preserve schema name in storage' checkbox?
On #3...Could I possible see some sample code on picking either MySQL or SQLServer in code and then creating a new database that a user selects? Lets say the name is stored in: string newDatabaseName;
Re: Evaluating Linq to Sql - have a few questions
The 'Preserve schema name in storage' option is located on the 'General tab of the 'Model Settings' dialog box. To open this dialog box, you can, e.g., double-click the diagram canvas. But if the model has already been created, it will not affect the existing entities. To remove schema name from the existing mapping, you should recreate your model with unchecked 'Preserve schema name in storage' checkbox.On number 2 if the lqml file has already been created where can I uncheck the 'Preserve schema name in storage' checkbox?
To bind the DataContext with the necessary database use the code:On #3...Could I possible see some sample code on picking either MySQL or SQLServer in code and then creating a new database that a user selects? Lets say the name is stored in: string newDatabaseName;
Code: Select all
System.Data.Linq.Mapping.MappingSource mappingSource = Devart.Data.Linq.Mapping.XmlMappingSource.FromUrl(mappingfile);
YourDataContext context = new YourDataContext(connectionString, mappingSource);
where 'mappingfile' - the full path to the mapping file (e.g. "C:\\...\\MySQL_mapping.xml" or "C:\\...\\SQLServer_mapping.xml")
For more information about using XML mapping, see http://www.devart.com/linqconnect/docs/POCO.html
To create a new database you can use:
Code: Select all
YourDataContext dc = new YourDataContext("Host = newDatabaseName; User Id = root; password = root; Port =3306;");
dc.CreateDatabase(false,true);
http://www.devart.com/linqconnect/docs/DDL.html
Re: Evaluating Linq to Sql - have a few questions
I need to recreate it from scratch? There is no other way? Could I perhaps copy and paste it to a blank canvas somehow? My project has over 50 tables / enums /tons of associations.....it would take a very long time to recreate it.The 'Preserve schema name in storage' option is located on the 'General tab of the 'Model Settings' dialog box. To open this dialog box, you can, e.g., double-click the diagram canvas. But if the model has already been created, it will not affect the existing entities. To remove schema name from the existing mapping, you should recreate your model with unchecked 'Preserve schema name in storage' checkbox.
Re: Evaluating Linq to Sql - have a few questions
You can try to manually change it. Do the following:
- open YourDataContext.lqml file in a text editor;
- remove all the names of the schema in it (e.g. you can use the automatic replacement and replace Table Name="SCHEMANAME. with Table Name=");
- save changes;
- re-generate the code and xml mapping file for your model.
Please notify us if this helps.
- open YourDataContext.lqml file in a text editor;
- remove all the names of the schema in it (e.g. you can use the automatic replacement and replace Table Name="SCHEMANAME. with Table Name=");
- save changes;
- re-generate the code and xml mapping file for your model.
Please notify us if this helps.