Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Error An item with the same key has already been added. in PetaPocoRepository method.Error An item with the same key has already been added. in PetaPocoRepository method.
Previous
 
Next
New Post
1/10/2016 9:23 AM
 

Hi to all

i wrote a module on dnn8 ,i used dnn service framework and petapoco for module datalayer.

i used the petapoco like below code:

PetaPoco.Database db = new PetaPoco.Database();
            DotNetNuke.Data.PetaPoco.PetaPocoRepository<TrainingCenterInfo> ppr = new DotNetNuke.Data.PetaPoco.PetaPocoRepository<TrainingCenterInfo>(db,
                                                                                  PetaPoco.Mappers.GetMapper((new TrainingCenterInfo()).GetType()));

in first step or in first call this method is true and worked to fetch data!!!

but on over call above methode,i get the error,the error message is : An item with the same key has already been added.

and the logged error in Log viewer is :

AbsoluteURLReferrer:http://localhost:85/%D9%86%D8%B4%D8%B1%D8%B4%D9%87%D8%B1/tabid/105/ctl/AddStudent/mid/494/Default.aspx

UserAgent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0

DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke

ExceptionGUID:741f74e4-4241-4eb1-9685-4f612722c9d6

InnerException:An item with the same key has already been added.

FileName:

FileLineNumber:0

FileColumnNumber:0

Method:System.Collections.Generic.Dictionary`2.Insert

StackTrace:

Message:

DotNetNuke.Services.Exceptions.PageLoadException: An item with the same key has already been added. ---> System.ArgumentException: An item with the same key has already been added.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at PetaPoco.Mappers.RegisterInternal(Object typeOrAssembly, IMapper mapper)
   at PetaPoco.Mappers.Register(Type type, IMapper mapper)
   --- End of inner exception stack trace ---

Source:

Server Name : 002-PC

where is my mistak? and what do i do for use petapoco in my module?

Thanks for your attention's and your replay.

 

 
New Post
1/11/2016 2:19 PM
 
Did you use the VS debugger and put a break point in your code so that you can review the data coming back and try to see if there is in fact a duplicate key being added to the collection?

Without the code running in a local dev environment I can only guess. My best guess is there is a problem with the lifetime of your collection variable or duplicate data in your data store.

Here is a similar issue but there is no resolution so it won't help you but you may still find it interesting.

https://dnntracker.atlassian.net/brow...
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Error An item with the same key has already been added. in PetaPocoRepository method.Error An item with the same key has already been added. in PetaPocoRepository method.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out