Using dbml file with visual studio - linq-to-sql

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)

Related

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.

How to I keep track of changes in FLA file (via version control)

I have all of my files in version control (SVN subversion). FLA file is not a text file, so when I change it and check it in, there isn't a way to see what has changed inside of FLA.
Is there a way to keep track of changes to FLA file and it's contents?
Flash CS5 has introduced a new file format called XFL which has been designed for use with version control systems. This format basically splits up your FLA file into a series of separate XML data files (all contained within the one folder) which means version control systems can accurately determine what parts of the file have changed.
Simply go to File > Save AS, and select xfl from the drop-down list.
If you're using anything before CS5, then unfortunately there is no similar way to accomplish this task. I will add, however, that if this is the case, then you can try and mitigate this problem by keeping all your code in an external AS file and load any data from external xml/image/etc. files. This way, there is at least some degree of tracking for certain parts of your project.

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.

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

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

How to build HTML Documentation with Sandcastle

How to build CHM / HTML Documentation with Sandcastle? Can build HTML file from XML or have to used .cs and dll files?
How to build CHM / HTML Documentation with Sandcastle?
Use the Sandcastle Help File Builder.
Can build HTML file from XML or have to used .cs and dll files?
I think it uses the *.dll and the *.xml (both together) as input. One of the 'tips' in the SHFB documentation says,
"When selecting either an assembly or an XML comments file, the help file builder will automatically add the partner file for you (i.e. the XML comments file for the like-named assembly or the assembly for the like-named comments file). Multiple files can also be selected and added in one go or dragged from Windows Explorer and dropped on the Documentation Sources node."
Sandcastle uses dll to generate documentation. It also needs the xml from code comments to be build by visual studio. To do that, basically select output XML from your project build properties and then open the csproj (your VS project) in SandCastle Help file builder.