Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Saying I do not have a pirmary key mvc scafolding ?.
 

Pages: 1
LLBLGen Pro Runtime Framework
Saying I do not have a pirmary key mvc scafolding ?.
Page:1/1 

  Print all messages in this thread  
Poster Message
david38ni
User



Location:
Belfast
Joined on:
04-May-2016 11:53:21
Posted:
7 posts
# Posted on: 04-May-2016 15:23:58.  
I have just purcashed version 5 and I am running into a few issues it says that me table does not have pimary key when i try to scaffold the list but in fact it has im using uniqueidenfiiers as pks and dont no why this error is showing.

  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14585 posts
# Posted on: 04-May-2016 23:23:34.  
Quote:
it says that me table does not have pimary key

What is saying this? and what is the exact text error or exception and stack trace?

Could you please provide more details?
Please check what is needed from you here:
http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7722


  Top
david38ni
User



Location:
Belfast
Joined on:
04-May-2016 11:53:21
Posted:
7 posts
# Posted on: 05-May-2016 09:28:45.  
I am trying to use entity framework 6 but its saying ProviderManaifesTokenValue hasent been set I am using sql server 2014 express and standard on the production machine.


Quote:
Full Error Message Type    Description    Source    Time
    The target framework specific setting 'ProviderManifestTokenValue' hasn't been set to a valid value. This value is required by the Entity Framework at runtime.    Project Validation    08:29:56
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37878 posts
# Posted on: 05-May-2016 10:42:42.  
david38ni wrote:
I am trying to use entity framework 6 but its saying ProviderManaifesTokenValue hasent been set I am using sql server 2014 express and standard on the production machine.


Quote:
Full Error Message Type    Description    Source    Time
    The target framework specific setting 'ProviderManifestTokenValue' hasn't been set to a valid value. This value is required by the Entity Framework at runtime.    Project Validation    08:29:56

I have already explained to you where to fix this, in project settings, you have to set this value for entity framework. this is also explained in the error itself btw: the error has suggestions with it (click it open to see them) which explain what to specify. For 2014, you can specify 2012 or 2008 as providermanifesttoken. It's a token that has to be specified for EF to work (it's a requirement for EF6).

This is also a completely different issue than the issue in the start post of this thread. The post you start this thread with has little info: what does complain about the PK fields, is that the scaffolding wizard in vs.net or the designer? the scaffolding wizard does that see the context / entities?


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
david38ni
User



Location:
Belfast
Joined on:
04-May-2016 11:53:21
Posted:
7 posts
# Posted on: 11-May-2016 12:18:03.  
Yes I no you did but i cannot see where i need to place the value !.

I looked in that screen and could not find the option for this

Also it is in the scafolding when I go to generate a screen in that case I get the complaint about the pk.

Screen shot of section i do not see the tag area for that value !

https://snag.gy/ev9ChH.jpg

And this is the error i am getting on the primary key i managed to find the token value so thank you saw it after the screen shot.

https://snag.gy/Dh2LXz.jpg
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37878 posts
# Posted on: 11-May-2016 12:38:17.  
It's at the right in your screenshot, 3rd line from the bottom 'Provider manifest token value' Regular Smiley

About the MVC scaffolding issue: please provide steps how to reproduce that.


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
david38ni
User



Location:
Belfast
Joined on:
04-May-2016 11:53:21
Posted:
7 posts
# Posted on: 11-May-2016 12:47:29.  
And this is the error i am getting on the primary key i managed to find the token value so thank you saw it after the screen shot.

https://snag.gy/Dh2LXz.jpg

This is the values I use for the scafolding ?.

https://snag.gy/CiZx3G.jpg

Here it shows the pk in the entity

https://snag.gy/6Qdx8X.jpg

and here it shows it in me db

https://snag.gy/X8Q1hn.jpg

  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37878 posts
# Posted on: 11-May-2016 15:57:17.  
I search for the error, and got here:
http://stackoverflow.com/questions/27205961/entity-type-has-no-key-defined-ef6

So you have 2 options it seems: (this is MVC scaffolding's requirements, and not a problem of our tooling, but I can imagine it's daunting what to do at this point)

1) add [Key] attributes to the PK fields (I'll describe how to do that below).

OR

2) Rename the PK fields so they match the pattern <classname> + Id

The second one seems pretty cumbersome, so I'll explain how to do 1).

I also would like to point you to some other things: In the project settings we have extensive features for Name construction. There you can define strip patterns to strip off 'Tbl' prefixes for example. See: http://www.llblgen.com/Documentation/5.0/Designer/Functionality%20Reference/ProjectSettings.htm#conventions-entity-model-element-name-construction and scroll down a bit under 'Name construction, Strip patterns'. It does require to recreate the project, but if you want to use better names, you can. You also don't have to suffix the names with 'Entity', the EF6 templates don't require that.

Anyway, to apply [Key] attributes to all entity PK fields, do the following.

1) Open the project, and then right-click the project node in project explorer and select 'Settings' to open the project settings
2) Navigate the left tree: Conventions -> Entity Model -> Code generation -> Attributes and click that node
3) On the right you can now select an element type. Select from the element type list 'Normal field'
4) In the grid below it, add a new row. For Attribute Definition, specify "Key" (without the quotes). Press TAB to go to the Has rule column and click '...' next to the 'no'.
5) The rule editor pops up. Click [+] to add a new rule. In the first combo box select 'Is part of PK'. In the second combo box select 'is true'. Click OK
6) You're now back in the attribute grid. Press enter to add the row to the grid. Then click OK to save the settings.

If you now edit an entity in its editor, and go to the code generation info tab and its Attributes sub tab, and select a field that's a PK field, you'll see the Key attribute is assigned to that field. If you select a non-PK field, you'll see the attribute isn't there.

This is now defined for all entities, and when you make changes the attributes are taken care of. So generating code will apply the [Key] attribute to the PK properties in the entity class.


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
david38ni
User



Location:
Belfast
Joined on:
04-May-2016 11:53:21
Posted:
7 posts
# Posted on: 11-May-2016 16:18:53.  
Only step You're now back in the attribute grid. Press enter to add the row to the grid. Then click OK to save the settings I am worried about i have done all the previous mate so what row am i adding here

https://snag.gy/HEJ4sB.jpg
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37878 posts
# Posted on: 11-May-2016 19:11:37.  
Please do steps 1-3 first, you have to edit the row in the project settings. I've explained where in steps 1-3. When you click 'Attributes' in the project settings tree you'll get a grid on the right. You're editing fields in the entity editor, completely not where I said you should go to Wink

See: http://www.llblgen.com/Documentation/5.0/Designer/How%20To/AssignAttributesToElements.htm


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.