Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Ado.net Entity framework in DNN 5 modules always fails?Ado.net Entity framework in DNN 5 modules always fails?
Previous
 
Next
New Post
9/10/2009 5:07 PM
 

I am trying to use entity framework in a DNN 5.1 module. For some wierd reason, I keep getting the error 'Index is outside the bounds of the array.' and then the built in development server crashes with an unhandled exception was thrown error in the Dr. Watson debugger window. What could possibly be the problem?

 

The exact SQL statement I am trying to convert to entity query model is:

 

select top(1) * from Testimonials where ModuleId=@ModuleID order by NewID()

 

This is the Query builder methods I used to create the same thing:

 

using DB as new TestimonialsModelContainer()

formView1.DataSource = DB.Where(It.ModuleID = @ModuleID", New ObjectParameter("ModuleID", ModuleID)).OrderBy("NewID()").Top(1)

formView1.DataBind()

End using

 

I went through the standard EDML wizard, chose the SiteSqlServer connectionString from the web.config, choose the Testimonials table from the list and let the wizard create the model. I then told the wizard the Context namespace was EternityRecords.Modules.Testimonials and let it finish. I then used the Entity framework adaptor for DNN to allow for objectQualifier and databaseOwner changes. Any clue why this would fail? I used some sample queries from the entity framework part of msdn to the T, except adapting them to fit the model I use. Still fails. Hopefully we can get this running.

 
New Post
9/11/2009 7:13 AM
 

did you check out the new EF provider by Brandon Haynes?


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
9/11/2009 8:29 AM
 

Yup. That is the DNN EF adaptor I was talking about. Just sent a comment on the blog post for it, so will see what happens. I might do some comparisons between linq to sql/EF with and without the adaptor to see if the same queries fail under both instances or not. Seems strange that they would fail at all since there have been similar ones I used to run all the time.

 
New Post
9/11/2009 8:36 AM
 

Hi Andy,

Your approach appears to be largely sound here.

Couple questions:

1. Does this work *without* the DNN-EF adapter?  I would not be surprised if some bugs existed at that level (it was just released this week and is still technically in beta) -- the EF is a pretty large framework and there are plenty of strange ways to interact with it.  Taking the adapter out of the equation would be very helpful in identifying your issue.  (Regardless, I would not expect a hard crash caused by the adapter.)

2. What is the column schema of your Testimonials table?  I'll attempt to reproduce locally.

3. Does an exception stack exist in your event viewer?

Consider opening a work item on the project website with your module files (simplified to the minimum necessary to reproduce the problem, along with SQL to generate the table and data).  If I can reproduce the problem locally, and it IS caused by the DNN-EF adapter, I'll be happy to investigate a remedy.

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
9/11/2009 8:46 AM
 

Had one more thought on this -- does the sample module that I packaged with the adapter release work on your system?  That should give some additional evidence about whether this is an adapter-related issue, or a deeper EF- or system configuration-related problem.

Brandon


Brandon Haynes
BrandonHaynes.org
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Ado.net Entity framework in DNN 5 modules always fails?Ado.net Entity framework in DNN 5 modules always fails?


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.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out