importing a pre-existing edmx file is a new vs 2010 solution - edmx

Hi I started from scrath a new vs 2010 solution.
How can I add a preexisting edmx file generated with the vs tool avoiding mess :)? (The cleanest way)
Thanks a lot!!

I am quite sure that adding the edmx file as an existing Item will work quite well. You will have to add the adequate connectionString in your config file however.
<add name="<EntityContainerName>" connectionString="metadata=res://*/<pathToEDMX>.csdl|res://*/<pathToEDMX>.ssdl|res://*/<pathToEDMX>.msl;provider=System.Data.SqlClient;provider connection string="Data Source=localhost;Initial Catalog=MyDatabase;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
where pathToEDMX is the path to your edmx file in the project (for exemple Models.Model if you included the Model.edmx file in the Models directory of your project)
You will want to change the database connection string in this mmodel connection string too.
In order for this connecion string to work, the model option "Metadata Artifact Processing" must be set to "Embed in Output Assembly"

I agree with the Eilistraee, But I have another openion which is very much procedural. you can add this existing edmx file to your project. then you can open the edmx file and create database from this model(this can be done by right clicking on the entity diagram. ), when you select the proper database, it will automatically create the connection string in your app.config. Good luck.

If you want to do this, the way I found to do this is:
Open the solution that the contains the project you wish to import into.
Add the project that contains the edmx you want to import.
Copy and paste the edmx file from one project to the other.
Remove the second project and proceed.
This might be necessary: Open the edmx, adjust namespace, etc and save it.
VS 2013 and EF 6.1

Related

How to modify Access DB File which is in sharepoint Document Library

I am having accdb file(Ms access DB file) in sharepoint Document Library. I want edit the file in browser or without downloading the file to the local.
I am able to view the file but not able to Edit it.
Need help
Access doesn’t really work this way. You can store the data tables in Sharepoint, but you still need the local access file to interact with it. You can link to data tables in Sharepoint. Instead of creating a brand new table, you import the data source.
Microsoft does have a newish program out now called PowerApps that may help you accomplish something closer to what you’re describing.

How to upgrade Linq to SQL dbml file from old version of VS?

I opened an old project, and I can't open the dbml file.
For some reason I get "Cannot load.. check Error List window for details".
But, there aren't any errors.
I can create new dbml file, so there is no problem in the viewer itself.
Is there a known issue?
The first thing I would check is the connection string of the dbml file, which you can find in the FileName.designer.cs (or could be .vb instead of .cs) file that is attached to the FileName.dbml file.
If you say you can create a new dbml file, then it is possible that the old dbml file has an outdated connection string.

Using dbml file with visual studio

I am developing an asp.net application where some dbml files have been created. When I click on a dbml file called "Test.dbml" and that I unfold it, I get the three following files :
Test.cs
Test.dbml.layout
Test.designer.cs
However when I create a new dbml file and that I unfold it, I only get the two following files :
Me.dbml.layout
Me.designer.cs
I don't understand why I don't get the Me.cs like the existing dbml.
I only have access to the old code, not to the developper who code it so I cannot ask him the question.
Thanks in advance foryour help.
By default VS generates a .dbml.layout (visual layout) and .designer.cs (C# generated code) in addition to the .dbml file (XML definition of the mappings)
If you were to put your code in the .designer.cs file it would get lost so VS can also generate a .cs file for you to put your code in.
Simply right-click on the DBML and choose View Code.
At compile time the .cs and .designer.cs are effectively merged together as they are partial classes (the partial keyword needs to be on the class definitions)

CakePHP 2.x Project with unknown folder structure and database file, using EnvSwitcher Class

I have a new project that is using a plugin class called EnvSwitcher. I went to set up the database file and the database.php file is empty, except for two lines I have never seen:
App::uses('EnvSwitcher', 'Lib/EnvSwitcher');
EnvSwitcher::includeBaseFile(__FILE__);
The project does not load, only gets white screen. I tried adding the database connect info to the file, and nothing. Tried to even replace the two lines with regular database info, and still nothing. What is going on with this?
It's an Environment switching class. You are using the class here:
https://github.com/angelxmoreno/CakePHP-Environment-Switcher/blob/master/EnvSwitcher.php
Check in folder: Config/env/_default/
There should be copies of your config files there to modify.
If there is more than folder in: Config/envs, then there should be a copy of the files in each one to switch between environments.

Adding column manually to table in dbml file

I manually added a column to a table in a .dbml file by editing the xml.
Hereafter I rigthclicked the .dbml and chose 'Run Custom Tool'.
I'm new to linq-to-sql and is working on an existing MVC webapp with domainmodel and viewmodel.
The solution also contains a database project which I know was not updated automatically.
Now I need to know how to check that everything was updated correctly. Is it only the .dbml and the .designer.cs that I can expect to be changed after running the custom tool?
'Run Custom Tool' does the trick. Nothing else is needed.
And no other files than .dbml and the .designer.cs files are changed.