Silverlight application ado.net data model

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
b.szabo
Posts: 14
Joined: Wed 04 Jul 2007 05:50

Silverlight application ado.net data model

Post by b.szabo » Tue 21 Jun 2011 11:29

Hi,

I've just installed the dotconnect universal 3.20 and trying to start a silverlight application, generate an ado.net data model for mysql database at the web project. The problem is that I cannot initialize in the connection because there is no dotconnect option only the standard microsoft sql server standard connectio. I'm using visual studio 2010 professional, and shows that the product is properly installed. Secondly I've had to add the tool box also manually. I've tried reisntalling 2 times already. Am I doing something wrong, can you let me know, how to fix this issue?

Thanks,
Barnabas

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 21 Jun 2011 12:30

I suppose you mean ADO.NET Entity Data Model?
dotConnect Universal does not provide the Entity Framework support (it contains the Standard edition of dotConnect providers, and the Entity Framework support is available only in the Professional and Developer editions of dotConnects).
You will need dotConnect for MySQL Professional for Silverlight applications with MySQL database back-end.

b.szabo
Posts: 14
Joined: Wed 04 Jul 2007 05:50

Post by b.szabo » Wed 06 Jul 2011 09:01

ok, thanks I have the MySQL dotconnect professional, and have the following problem:
- The MySQL DB is 4.1 that we are getting the data out.
- The DB connections is working and I can see tables in DBForge
- But when I want to use the Entity Data model, then I have exception
System.NotSupportedException, it says that the ADO.Net framework is supported only servers above 5.0. If this is the case then, can you let me know why was this not mentioned on the product description?

Thanks,
Barnabas

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 06 Jul 2011 13:12

I recommend you to add a Devart Entity model to your project. It has the same functionality that the Microsoft models, but we have better control over metadata and more convenient designer - Entity Developer (with Visual Studio Integration).

b.szabo
Posts: 14
Joined: Wed 04 Jul 2007 05:50

Post by b.szabo » Wed 27 Jul 2011 04:21

Thanks it worked very good. But I have the next problem:
The Entity model have been generated, the domain service based upon the entity model has been generated, but when I want to make the load operation for the query into a datagrid, i have the follwing exception:
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
Which I don't really understand why is this happening, if the Entity model can update data from the database. Please give me some somultions, what am I doing wrong.

Thanks,
Barnabas

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 29 Jul 2011 10:59

Please make sure that:
1) your have set connection string in your *.config file in the correct format like 2) you have informed your environment about the existence of DbProviderFactory: http://www.devart.com/dotconnect/oracle/docs/?EF.html , the Deploying an Entity Framework Project article.

Also refer to http://social.msdn.microsoft.com/Forums ... 146d8e1a68 .

EDIT: corrected the connection string
Last edited by Shalex on Mon 01 Aug 2011 16:29, edited 1 time in total.

b.szabo
Posts: 14
Joined: Wed 04 Jul 2007 05:50

Post by b.szabo » Mon 01 Aug 2011 04:02

Thanks for the feedback, I've made the changes, and changed the connection strings. Now I have the following exception:
System.Net.WebException: The remote server returned an error: NotFound
But I can update the Entity model and get data from it with the same connection parameters. I don't really understand what is the problem here.
Here is my connection string:

Code: Select all

 
    
    
  

When I change the providerName to "Devart.Data.MySql" then I have the original failure again the connection is not even recognized.

Appriciate the help here.

Thanks,
Barnabas

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 01 Aug 2011 16:54

1. Now the format of your connection string seems to be OK. You are right, the providerName should be "System.Data.EntityClient" (I have corrected my previous post).
2. Is your database located on the same host where you are running your application ("Host=localhost;")? Try setting Host to IP address or DNS name.
If this doesn't help, validate your connection string via plain ADO.NET (create the MySqlConnection object with your connection string and open a connection) or via any other tool.
3. As I understood, the current exception you are getting is "System.Net.WebException: The remote server returned an error: NotFound ", isn't it?

We need your inner exception and call stack to identify the reason of the problem.

You can go to Tools->Options...->Debugging, and disable the Enable Just My Code (Managed Only) check box. Then go to Debug->Exceptions and enable Common Language Runtime Exceptions check box. These actions will allow you to catch the inner exception before it is wrapped by Entity Framework code.

If the Debug mode of Visual Studio you are running your code from doesn't show call stack, you can obtain it by connecting from another instance of Visual Studio (2nd) (Debug | Attach to Proccess) to the first VS. Before attaching don't forget to make these settings in your 2nd Visual Studio: a) in the (Debug | Exceptions) window select Common Language Runtime Exceptions; b) in the (Tools | Options) window, Debugging | General - clear Enable Just My Code (Managed Only).

b.szabo
Posts: 14
Joined: Wed 04 Jul 2007 05:50

Post by b.szabo » Tue 02 Aug 2011 05:50

- Changed it from localhost to IP address, then this error is thrown:

Code: Select all

{System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'GetEndproducts'. Exception of type 'System.ServiceModel.DomainServices.Client.DomainOperationException' was thrown.
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.c__DisplayClass1b.b__17(Object )}
- This is the stack track trace for app exeption breakpoint with localhost:

Code: Select all

{System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'GetEndproducts'. The remote server returned an error: NotFound. ---> System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
   at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.c__DisplayClass5.b__4(Object sendState)
   at System.Net.Browser.AsyncHelper.c__DisplayClass4.b__1(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.
CompleteGetResponse(IAsyncResult result)
   --- End of inner exception stack trace ---
   at System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
   --- End of inner exception stack trace ---
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.c__DisplayClass1b.b__17(Object )}
Then I've made the changes in the debug mode as you mentioned, and then I have another error, which really doesn't mkae any sense:

Code: Select all

System.IO.FileNotFoundException occurred
  Message=Could not load file or assembly 'System.ServiceModel.Extensions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
  StackTrace:
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
I'm totally lost here, what can I do?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 02 Aug 2011 13:31

1. Make sure that your connection string is valid (connect to your MySQL server using another tool or plain ADO.NET in a simple console application).
2. Try localizing the problem - is it caused by whether Devart Entity Model or Silverlight Application? Add your model to simple Console Application, create an instance of a context, and execute a query. Does it work in this case?

Post Reply