Print Page | Close Window

WPF CodeFirstWalk

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3470
Printed Date: 13-May-2026 at 8:27am


Topic: WPF CodeFirstWalk
Posted By: geraldg
Subject: WPF CodeFirstWalk
Date Posted: 01-Jun-2012 at 4:04am
Hi there.
We are planning to convert our very old vb6 application to a .net application.
So i'm busy shopping for the quickest route in doing this and you are defiantly one of the candidate to choice from with the process. anyway.

All out clients use MYSQL as a database engine.
So I busy working though your examples and I like the code first approced
The first example you give your using MSSQLEXPRESS, but I want to pass my own connect string, but it seems to default to MSQLEXPRESS database. Here is my connect string.

 <connectionStrings>

    <!-- Remember to add your connection string(s) here -->

 <add 
     name="CodeFirstDemo" 
     connectionString="data source=.;server=127.0.0.1;User Id=root;password=letmein;database=medxpress;Persist     Security      Info=True" 
     providerName="Mysql.Data.MysqlClient" 
   />    
    
  </connectionStrings>


What am i doing wrong, it's suppose to default to this connect string regardless. Please Help.

Ok, 2 more things, I'm based in South Africa, how do I go about in buying you software.

Last Question. If you had to develop a clean fresh system, what platform/technology will you go with that comes into your mind as a future project.

A)  Sliverlight - but news is version 5 is the last version and only supported until 2021
B)  WPF - very powerful but needs to be installed at client side, were web base dont have 2
C)  HTML5 - not sure about JavaScript and still new from what I garter.

Please, what will be the future technology to use.
Thanks in advance









Replies:
Posted By: DenisK
Date Posted: 01-Jun-2012 at 5:35pm
Hi geraldg,

A sales person will contact you on purchasing the product and a senior engineer will response to your platform/technology question.

I can try and help you with the MySql problem.

Your connection string seems to be incorrect. Try changing them to:

<add name="CodeFirstDemo"
         connectionString="Server= 127.0.0.1
                                       Database= medxpress;
                                       User Id=root;password=letmein;
                                       Persist Security Info=True"
         providerName="MySql.Data.MySqlClient"/>

I'm also assuming that you have downloaded MySql Connector, ADO.NET driver for MySql db.  http://dev.mysql.com/downloads/connector/net - http://dev.mysql.com/downloads/connector/net


Posted By: ting
Date Posted: 01-Jun-2012 at 6:19pm
Regarding technology platform, your summary is pretty good. I would add:

Silverlight - If you need to run in a browser and want to minimize client installation process.
WPF - If you have heavy client-side integration.
JavaScript - If accessing the application on many form factors (phone, tablet, desktop) is important.

We are working on a JavaScript product, but you are correct that the space is still very new and it will take years for the community to develop all the tooling and techniques for building moderate sized line of business applications in HTML 5 / JavaScript.



Posted By: geraldg
Date Posted: 04-Jun-2012 at 12:05am
Hi all. Thx for the quick response.

What the connect string is concern, I am using MySql Connector, ADO.NET driver and my connect string was like that, the above example is jut a guideline. It just doesn't make sense that it defaults to the MSSQLEXPRESS server regardless of the connect string. There isn't even any error to give me direction on were the problem exist.

What the technology platform is concern.

We have over 200 clients that uses a vb6 / MYSQL server application.
About 20 percent of our clients don't have internet access, so I don't know if you can host a Silverlight as a standalone machine, but with Silverlight not being supported from 2021, i'm not sure if that is the platform to use but my boss realty wants a web base system. So my decision the is still in the clouds.

My current option is the go with WPF, and that's what I want to convince my boss to, but my question is, is WPF way to go with the future, and now that windows 8 on it's way. What does you other clients say about this, and what  technology does most of your clients go for.

I need to decide on a platform as soon as possible, because my deadline is middle next year, so if you can assist me with the right decision I would be great full. 


Posted By: mgood
Date Posted: 04-Jun-2012 at 1:53am
Unfortunately in Software and Technology, the next thing is always just around the corner, but that's what makes it so interesting. The best thing you can do is hedge your bets and build your application such that you can reuse as much as possible if you have to retarget it to a new platform. Let's look at WPF, Silverlight and WinRT/Metro. What these three platforms have in common is XAML and the .NET Framework. While Silverlight as we know it today may go away, XAML and .NET is here to stay. The XAML stacks and the .NET profiles between the three platforms are not exactly the same, but there are libraries and frameworks that hide the differences. We have our own framework called Cocktail that we make available to our customers. Cocktail is an application stack to develop XAML based data-driven applications with DevForce. It currently supports WPF, Silverlight 4 and Silverlight 5 and it will support WinRT/Metro. If you build an application with Cocktail as long as you keep it asynchronous you will be able to move between these platforms with very little changes. Cocktail for example comes with a reference application called TempHire. There's a WPF and Silverlight 4 version. Both versions share over 95% of the code. The differences are mostly in  the Views, which is what you want. The actual UI, what you see on the glass, will be different between Silverlight and WinRT/Metro for example, but your UI logic, your business logic and data access logic will be largely the same. 

To learn more about Cocktail, check out the website: http://cocktail.ideablade.com/ - http://cocktail.ideablade.com/

Now, HTLM5/JavaScript is a bit different. You won't be able to easily port a XAML application to HTML5/JS, but as mentioned, we are working on a product that aims to give you the familiar DevForce experience on a Javascript client with the same back-end as a XAML client. Eventually, once this new field has matured a bit we may offer a Cocktail-like stack for Javascript as well.

Hope this gives a little bit of a perspective.



Posted By: DenisK
Date Posted: 04-Jun-2012 at 12:36pm
Hmm, if there isn't any error and you're sure that the connection string is correct and yet, it always defaults to Sql Express, then my guess is DevForce is ignoring that connection string because it couldn't match it with the DataSourceKeyName or the name of your EntityManager or your custom DbContext if you have defined one.

Please see http://drc.ideablade.com/xwiki/bin/view/Documentation/code-first-set-database-connection-string - here  to learn more about CodeFirst and Connection Strings.

Another tool that you can use for further debugging is to see a more verbose build log output. Please see http://drc.ideablade.com/xwiki/bin/view/Documentation/code-first-troubleshooting#HFailedtogeneratemetatdata - here  to learn how to change your Visual Studio settings and what to look for.



Print Page | Close Window