Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fails to Scaffolding on project which has a reference to edmx

I have Demo solution with two projects like this :

enter image description here

I have installed T4Scaffolding.Install-Package T4Scaffolding

I have added a reference of AdventureWorksModel to my RepoLayer Project and install EF6 .


Now when i try to run the following command :

scaffold repository AdventureWorksModel.Customer to my RepoLayer Project

I get the following exception :

Get-ProjectType : Cannot find a type matching the name
'AdventureWorksModel.Customer'. Try specifying the fully-qualified
type name, including namespace.`

although the same command works successfully when i run it on AdventureWorksModel project !

like image 408
Anyname Donotcare Avatar asked Jan 26 '16 12:01

Anyname Donotcare


1 Answers

Here is the steps which you need to do

  1. Class library having AdventureWorksModel EDMX (already present)
  2. Class library "RepoLayer" which above AdventureWorksModel library, EF 6 installed (already present)
  3. In the "RepoLayer" library, please T4Scaffolding.Core.VS2015 and T4Scaffolding.VS2015 NuGet packages. I hope your using VS 2015
  4. Run the scaffolding command scaffold repository AdvwrksModel.Customer for "RepoLayer" library. The repository and DbContext class gets created successfully. Here is screenshot

T4 Scaffolding

Update related to EDMX name from above screen shot The command

scaffold repository AdvwrksModel.Customer

gives us important thought "AdvwrksModel" is EDMX name and namespace should be "AdvwrksModel". Then it will work fine.

From code link provided; After building, it gave same error what you mentioned in question, then after investigation it was namespace issue. Attaching screenshot with points 1, 2, 3, 4 should be "SledModel" i.e. EDMX name. Point 5 is generated repository for Race

I guess this will solve your problem. I am not sure how the namespace was different then EDMX name.

Update EDMX Name

like image 101
Mithun Pattankar Avatar answered Nov 10 '22 19:11

Mithun Pattankar