Entity Framework and MYSQL support

Jun 17, 2009 at 10:30 PM

Hello Mosessaur,

your web applicationi is very great, I like it very much :o)

Can you give us an Example of how to setup KIGG for MYSQL ?

Thanks :o)

Coordinator
Jun 19, 2009 at 9:39 PM

Hello I am so sorry for the delayed response. It is just I am on business trip and I have no internet connection.

I finished a wiki article on how to set it up for Entity Framework in general Check it out here.

For MySQL settings, you'll need to do 2 things after finalizing what are mentioned in the above wiki link.

First change the Connection String, then change the SSDL file name in the settings to be DomainObjects.MySql

Let me know how does it go with you.

Jun 19, 2009 at 11:11 PM
Edited Jun 19, 2009 at 11:12 PM

Hi Moses
Thank you so much for your very detailled document
reading it,  I was wondering if it is not better having a separate configuration file for Unity section
This way, we can just reference the corresponding one in web.config
Going further, I would also create a separate configuration file for each of these sections
This will make web.config more readable

 

  • loggingConfiguration
  • exceptionHandling
  • cachingConfiguration
  • unity
  • assetSettings

By the way, thanks a lot for the great job.

regards
Nachid

Jun 20, 2009 at 9:46 PM

Thanks Moses,

very impressive but KiGG has a problem with the EFConnectionString in my Web.config  :o)

          <type type="IConnectionString" mapTo="EFConnectionString">
            <lifetime type="Singleton"/>
            <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
              <constructor>
                <param name="configuration" parameterType="IConfigurationManager">
                  <dependency/>
                </param>
                <param name="name" parameterType="System.String">
                  <value type="System.String" value="KiGGDatabase"/>
                </param>
                <param name="edmFilesPath" parameterType="System.String">
                  <value type="System.String" value="|DataDirectory|"/>
                </param>
                <param name="ssdlFileName" parameterType="System.String">
                  <value type="System.String" value="DomainObjects.MySql"/>
                </param>
              </constructor>
            </typeConfig>
          </type>

 

Source File: C:\Dokumente und Einstellungen\rembitzki\Eigene Dateien\Visual Studio 2008\Test\KIGG\EnterpriseLibrary\Unity\UnityDependencyResolver.cs    Line: 20

Exception Details: System.ArgumentException: The type Kigg.EF.Repository.ConnectionString cannot be assigned to variables of type Kigg.LinqToSql.Repository.IConnectionString.
Parameter name: from

Source Error:

Line 18:         {
Line 19: UnityConfigurationSection configuration = (UnityConfigurationSection) ConfigurationManager.GetSection("unity");
Line 20: configuration.Containers.Default.Configure(_container);
Line 21: }
Line 22:
Jun 20, 2009 at 10:50 PM
Edited Jun 20, 2009 at 10:53 PM

I guess you should also look for this entry in web.config file

<typeAlias alias="IConnectionString" type="Kigg.LinqToSql.Repository.IConnectionString, Kigg.Infrastructure.LinqToSql"/>

And change it to

<typeAlias alias="IConnectionString" type="Kigg.EF.Repository.IConnectionString, Kigg.Infrastructure.EF"/>

May be Moses forgot to mention this in his document

regards
Nachid


Coordinator
Jun 21, 2009 at 8:57 AM

@nachid I agree with you! and I was thinking of applying that but I was busy with Entity Framework documentation & MySQL documentation which so far not complete and
that is why I didn't publish it on front page.

This separation should be done easly because it is supported out of the box by Enterprise library. I just need sometime to apply it. I already did that in other project
I have.

@rembitzki as nachid said I might forgot to mention this! sorry for that but without you guys I might not be able to find bus in documentation :o)
I am on a trip now and not able to have continues internet connection. But I will trace this issue and highlight it and might update the documentation.

 

Thank you guys for the cheering comments

Coordinator
Jun 21, 2009 at 9:13 AM

@rembitzki I noticed that nachid is right, I didn't add settings for IConnectionString in Type aliase.

I will update that soon.

Coordinator
Jun 24, 2009 at 6:29 PM

I updated the documentation to fix the issue mentioned in this thread.

Sections updated are:

Registring Entity Framework repository types and adding mapping for IConnectionString interface.

I hope this will resolve the issue. and sorry for the delay. Soon will update the wiki to add link to this article as well as adding another article to configure MySQL database and KiGG to use MySQL