Where would I start in creating my Windows Workflow for Entity-Framework Database Generation from a Model? Where do I find the template for that? When I try to add a new item, Windows Workflow does not show up. MSDN doesn't have any documentation on how workflows work for generating to an Oracle database.
The Generate Oracle Via T4 (TPT) workflow just executes set of referenced T4 transformations. Just check the folder where this workflow is stored and there will be some Oracle specific transformation like CSDLtoMSL.tt and CSDLtoSSDL.tt - you need to change those two to use your new database naming convention.
Related
I want to integrate a local database into Windows Phone 7 project. The DB should be allready filled with values from manual input.
Therefore I use a wizard to create a local Database in WPF.
I can create tables, set their values and fill in them, but I could not find the way how to refere columns from different tables.
Is it possible using UI wizard in Visual Studio or only possible by coding the datacontext?
It is possible what you ask and the easiest way to do it is Linq to Sql.
Database Management in Mango
There is an easier way to do it but i think ms doesn't support that, you create a new windows WPF project and there you add a LinQ to SQL database model there you can create your database and then just copy it to your wp7 project and include it in the solution.
Then you will have to comment out or delete the two constructors which are not supported by the WP7 and your are ready to use your database.
The two constructors to comment out use System.Data.IDbConnection connection
This solution is explained in detail in Corrado's Blog
I have a master database where we define all information of our software.
It contains
tables
queries
trigger
stored procedures
stored functions
meta data
in the table (content)
At the moment, with every change I manually (with some support from SQL Management Studio) edit files where I have all the CREATE, UPDATE, INSERT statements for the stuff mentioned above. When I have to create a new database I fire-up all the xyz.sql files, which contains my SQL statements.
I know there is a database creation script wizard in management studio, but this for example doesn't include the content data. I also need to make sure the stuff is executed for creation in the right order (e.g. queries , function, etc. last then structure tables are available).
At the moment I was thinking about a .NET project where I start read all the shema tables and then create the files automatically. In Ruby on rails the system creates a shema.rb and for the data yaml files. I tried work with this, but as many tables not created by active record (old c++ stuff also running), this won't work for me.
So does anyone have any hint for me how to do this best or any tool that fits perfect to my demand?
You can do this very easily in .NET using the SMO frameworks.
There are integrated tools for scripting out in dependency order, and you can script out data as well if you desire.
See my answer here for some info and links.
SQL Compare Pro should be able to load up your DDL creation scripts and deploy them to a target in the correct order. In the Edit Project dialog make sure you load your scripts as a Scripts Folder. For the data you'll need to use SQL Data Compare Pro. If you have any trouble or have questions, let me know as I work for Red Gate so will be able to help you with these tools.
I'm a little confused about why you've got UPDATEs given that these scripts create a database from scratch. Shouldn't they all be INSERTs?
SSMS does have the ability to create data scripts as well. You need SSMS 2008 and you need to go to Tasks/Generate Scripts and in the Choose Script Options pane you have to make sure Script Data is set to True.
If you're looking to maintain these scripts as a sensible way to source control your SQL Server objects, you might want to consider SQL Source Control. This will maintain your schema objects AND static data tables as individual .sql files.
"I know there is a database creation script wizard in management studio, but this for example doesn't include the content data."
You have to look carefully! Of course this build-in script engine can include the content data. You just have to click the button labeled "properties" (or something like that) and there you can change all the SMO script options including a full data dump.
This ends up in the script with many INSERT INTO... statements.
In-depth description
Try DbSourceTools.
It is a SQL Management tool designed specifically to script SQL databases to disk ( including data ), and then re-create them using "Deployment Targets".
We are using it for database source control in an agile project.
I'm wanting to create a database programmatically from the edmx or edmx.sqlce file in my project. I read the best practice when sending the data out to users this is the best way. But I haven't found anything on it. Or is it best to create it and send it out with the program? How would I do updates to the database if I did this? How do I tell which version the database is?
Sorry for the multiple questions in one. I'm new to programming/databases so I don't know how it is normally done and can't seem to find a book on it either.
The best practice in this scenario is creating installation package (.msi) which will install your application and execute script to deploy the database. The script can even check dependencies like SQL Server CE and .NET Framework. This will also solve your problem with database version because .msi installation package keeps this information so you can create upgrade .msi which will know that it must execute only change script for database instead of creating a new one. Be aware that creating installation packages is pretty complex task but this is the way how it is done in real products shipped to customers. In both my current and previous company we used WiX to create installation packages but we have special guy who does this.
There is no API to create database from EDMX file. Moreover EDMX file is not part of built application. Database generation is feature of VS2010 which uses either workflow or T4 template to transform EDMX into SQL script. The default template can create only full database script and you must execute it.
I described the way of creating deployment script for new version of database in separate question. It is related to code-first (EFv4.1) but the principle is the same. If you need to keep information about database version you can have special table for that and check the value in the table at the beginning of the upgrade script.
We have a desktop application built with WinForms in 4.0 framework. A single user can install the application and use a local SQLExpress installation. Or, the SQLExpress can be on another machine on the network. We want to give users ability to create new database(which will execute a sql script which will create the required structure) on any server instance. Is there a control which we can used to accomplish this? Or, what are the ways to accomplish the aim?
if you're using an ORM (such as nHibernate)- then these abilities come out-of-the-box.
otherwise- you can write stored procedures that build the desired database.
this is a little more tricky, but possible.
here is a good start on DDL.
In mySql Workbench there's a possibility to "sync" the model with the DB and vice versa. Is there a function like this in EF? I've added som entities and I'd like it to get reflected in the DB. Do I really have to regenerate the entire DB and loose data?
Thanks
Sadly there is no easy way AFAIK to do this today.
One way to handle this is to generate the DDL and then cut and paste the new sections into SQL Server Management Studio and run them there. If you want to maintain scripts for each release of the database you'll need to take an approach like this too.
See also: Database migrations for Entity Framework 4
PS The EF Power Pack: http://msdn.microsoft.com/en-us/data/ff830362.aspx may help. It says "The second useful feature related to model-first the ability to update an existing database and synchronize the model with it. This allows you to make changes to the model that can be deployed to the database without data loss."
if you are using the VS2010 then in Select your edmx designer ( designer showing tables) and right click it will show the update model option.