Sharing same (.edmx model) in multiple projects - entity-framework-4

I have created a database and converted the same in edmx/model in one of my ASP.NET sample projects.
Now I am creating another project in which I want to use the same .edmx/model. I try to copy the edmx model in second project and then adding up(Add existing item),
But the .edmx file is not showing up in the options,but I am getting the designer.cs. Am I am missing something here?
Is it possible to use the same .edmx in more than one project?

You should simply place your edmx model and all generated classes to separate assembly and share the assembly.
If you don't see .EDMX in Add Existing Item dialog make sure that you don't have filter for code files enabled. You need to show all files or data files to see .EDMX file.

Related

copy all artifacts in a project to a new folder and create a module from them in IBM RDNG

I am working on IBM RDNG 6.0.4. I want to copy (duplicate) all the artifacts of a
project into a single folder. Then create a module from it. Is there any trick to do it? My project has 1000+ artifacts stored in different folders.
Is there any API that can work?
To solve your issue you do not have to use API, because you can do almost everything directly from UI.
1) Create a view that will display all the project requirements.
2) Click on the created view and select option "Edit attributes from view"
3) Select attribute "Folder" for a list of available attributes and change it value to folder of your choice. This will move all your requirements to a single folder.
4) Later you can add those requirement to module using folders filtering or views inside the module.
BTW. DNG does not support adding base artifacts (requirements) to complex structures (modules).
Hope it will help.

How to copy paste my Mvc asp.net project?

My project name called Hotel, and I want to create another project called Hotel2 containing all files of Hotel for testing purposes.
What are the steps to copy it without getting any errors?
I've tried doing this a few different ways. I've found the safest way is to create a new project, add the files/components you need, and copy the contents of the files from project Hotel to the blank/default files in project Hotel2.
There is no fast and easy way to do it. If you try any shortcuts, it almost always causes problems and more work.

.dll Model classes not recognized in VS2013 when Adding View, Controller with CRUD actions in EF

Is anyone else having problems getting VS2013 to recognize Models from an external class library? I really don't want to have to manually create every view and every Action when adding new Controllers and Views. My ViewModels are also in an external .dll so the only option I really have is creating new ViewModels in current project and use some sort of AutoMapper to reduce grunt work. Thanks in advance.
Here is screen shots:
1. Add Controller:
2. Recognize Model and Context
Solution
Thanks to Sarbanjeet I thought I would share the steps taken. The projects must be referenced in order to perform the typical Add Views/Controllers with CRUD using EF in VS2013.
1. Add Existing Project
**2. Add Reference (csproj) not dll
Rebuild Main Project**
This makes sense since the class dll only contains the compiled classes while the project file contains data on the project itself.
Include external library dll in References folder using these steps.
Right click on References folder.
Click on Add Reference.
Then browse the project library and add it to references folder(Remember project reference not class reference).
Clean solution and rebuild it or unload project and reload it.
If no luck, try these methods Click here

How do I rename entity framework .edmx file

I have a new MVC 4 project developed by a third party. I want to rename the .edmx file before making some other changes and going to production. I can rename the file itself but the .tt files do not change.
I need to rename my edmx, the designer, diagram and both T4 template files. This is what I did -
Unload the project in VS, edit, rename all above files to whatever you have to. The first part of the name of all these files should be same.
Open project directory in Windows explorer and manually rename all above files. Names should exactly match with what you entered in project file in step 1.
Open both tt files, find and replace the original edmx file name there.
Open EDMX file in a text editor, find and replace with
Reload the project, right click both the tt files one at a time and Run Custom tool. This will regenerate any missing files.

How to generate a separated dll file for the code of a specific namespace

I have an asp.net mvc application, when I compile, it creates one dll file
However, I have some code that I would like to re-use in other projects
I guess I could create another project, then put this specific code inside it and it would generate a separated dll file.
But is there another way to process in order to put the code of a specific namespace of my current project inside a separated dll file?
Thanks
Put that code in a separate project--make that project a "Class Library". This will create a DLL for that project, and you only need to add it as a reference on the original project and any other project that needs to share that code.

Resources