What is in a mysql provider? - asp.net-mvc-3

I have been toiling with an issue with mysql connector on and off for the past 3 months using a workaround. I even filed a bug report recently. However, I have found multiple instances of mysql connector failing in situations of advanced linq use. Some dating back to 2009 ( 3 years ) and still unresolved. In almost every instance, the user switched connectors.
I am considering doing the same. However, I came across looking at where mysql connector exists inside of my project. From what I can tell, it is only an included .dll (mysql.data and mysql.data.entity). After that, it is referenced only in web.config.
The first reference to the connector is in the connection string, providerName = "MySql.Data.MySqlClient".
The second reference is the definition of the provider
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, mysql.data, Version=6.5.4.0,
Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
The third is inside of the assemblies
<add assembly="mysql.data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
And the last is another assembly reference
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.5.4.0" newVersion="6.5.4.0" />
</dependentAssembly>
Is this really the whole footprint of the connector?

Is this really the whole footprint of the connector?
Yes and no.
Yes
As far as the project which references the connector is concerned, this is the whole footprint. The only configuration that needs to be made is to have MySql.Data and MySql.Data.Entity added as references to the project. Usually these are inside of the packages folder, and are then copied into the bin folder once a reference has been added.
No
The connector has a lot of internal code going on. Because of where it is defined, the connector inherits from and extends on the DbProviderFactory. This extension involves many classes and sub classes which determine how the interaction to mysql is enacted. Because it is open source, the actual code can be downloaded from oracle.

Related

'The ADO.NET provider with invariant name 'Devart.Data.Oracle' is either not registered in the machine or application config file

Ok, there already is a similar issue. It is, however not exactly the same and the solution I got was not derived from the other issue's solution.
Here's my Web.Config setup:
<connectionStrings>
<add name="ADOEntities" connectionString="metadata=res://*/ADOModel.csdl|res://*/ADOModel.ssdl|res://*/ADOModel.msl;provider=Devart.Data.Oracle;provider connection string="User Id=dbUser;Password=*****;Server=oracleserver;Persist Security Info=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
Everything runs fine on my machine (sic), but when I tried to set the ws up on the quality server, I got the error on the title.
I got it working by following the steps in this ADO.NET link. Particularly,
You need to remove the defaultConnectionFactory registration and to add the Entity Framework provider registration by registering it in the entityFramework section
So the line defaultConnectionFactory must go
<entityFramework>
<providers>
<provider invariantName="Devart.Data.Oracle" type="Devart.Data.Oracle.Entity.OracleEntityProviderServices, Devart.Data.Oracle.Entity.EF6, Version=9.6.696.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</providers>
</entityFramework>
Then, add the System.Data section. In my case it looks like this:
<system.data>
<DbProviderFactories>
<remove invariant="Devart.Data.Oracle" />
<add name="dotConnect for Oracle" invariant="Devart.Data.Oracle" description="Devart dotConnect for Oracle" type="Devart.Data.Oracle.OracleProviderFactory, Devart.Data.Oracle, Version=9.6.696.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</DbProviderFactories>
</system.data>
If that still doesn't do the trick for you -- And it didn't for me -- try adding the following line to your context class:
[DbConfigurationType(typeof(Devart.Data.Oracle.Entity.OracleEntityProviderServicesConfiguration))] //Add this line
public partial class ADOEntities : DbContext
You might want to create a partial class, incase you're using ADO, Devart, or other auto-generated entity model, to avoid having this piece of code in an auto-generated class

Oracle Entity Framework name is already used by an existing object

I am trying to make the change from leveraging entity framework on my Local SQL DB to my production oracle database. I have gone as installing oracle.entityframework via nuget and making the required changes to my web.config file.
<dataSources>
<dataSource alias="<DatasourceName>" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xx.xx.xxx)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=<serverName>))) " />
</dataSources>
<add name="TestDBContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=UName;Password=PW;Data Source=<DatasourceName>" />
<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
With some changes to the default schema settings I got the update-database command executing successfully and can see the corresponding db tables are created in my oracle instance, however when I hit run on my app I receive a name is already used by an existing object error when my code attempts to make its first db call as seen in the attached screenshot.
Already Exists Error ScreenCap
I suspect that I have missed something regarding the creation and deletion of the table at run time but am at a loss, any help would be greatly appreciated.
Also regarding versioning. I using MVC 5.2.3 with EF 6
Thanks

Entity Framework with EF6 Runtime Exception 'Member Mapping specified is not valid'

I have just migrated to EF6 and here is what is happening.
I have done everything suggested in any post on stackoverflow or oracle so I decided to open another question.
1) My Model is in a separated assembly.
2) I have done everything that I was supposed to do to regenerate my Model (deleted the .tt files and refresh my model from DB).
3) After doing that, the new EF seems to be too smart and decided to create all my number(1) fields as boolean.
4) this would cause an enormous rework for me.
5) I decided to added the following entries to web.config in the solution where I have the Model.
<oracle.dataaccess.client>
<settings>
<add name="int16" value="edmmapping number(1,0)" />
<add name="int16" value="edmmapping number(3,0)" />
<add name="int16" value="edmmapping number(4,0)" />
<add name="int32" value="edmmapping number(9,0)" />
<add name="int64" value="edmmapping number(18,0)" />
</settings>
</oracle.dataaccess.client>
I refreshed my model and everything was fine.
6) When I run the app that has reference to my Model Assembly, i get the following exception when opening my connection to the Oracle Database.
error 2019: Member Mapping specified is not valid. The type 'Edm.Int16[Nullable=True,DefaultValue=]' of member 'TRACKATTENDANCEFLAG' in type 'Model.FACILITY' is not compatible with 'OracleEFProvider.number[Nullable=True,DefaultValue=,Precision=1,Scale=0]' of member 'TRACKATTENDANCEFLAG' in type 'Model.Store.FACILITY'.
7) I have added the same entries in the application that uses the Model but it does not matter, I keep getting the same exception.
8) I'm not using the Managed Drive. I'm using the Oracle.DataAccess.Client.
9) Oracle.DataAccess.Client version 2.121.2.0
Oracle.DataAccess.EntityFramework version 6.121.2.0
Does anyone have any ideas? I spent more than 20 hours trying to figure out. I have tried all possible combinations.
It is so freaking wrong that Oracle would let me generate my Model but failed during runtime against the exact database.
I appreciate any help
Had the same issue and tried all solutions I've found. The only one that worked was adding the following code to all my Web.config and app.config files under the <connectionStrings></connectionStrings>.
<oracle.manageddataaccess.client>
<version number="*">
<edmMappings>
<edmNumberMapping>
<add NETType="int16" MinPrecision="1" MaxPrecision="4" DBType="Number"/>
</edmNumberMapping>
</edmMappings>
</version>
</oracle.manageddataaccess.client>
My setup is:
EF6
Oracle ManagedDataAccess Client 4.121.2.0
I had a similar problem with the same error message. In my case I was trying to map a number(1,0) column to a boolean and I am using an EDMX file. Previously this project worked and didn't display an error message but with the latest version of oracle developer tools installed and Visual Studio 2019 it started displaying this error message. The project compiled and worked fine but adding this to the web.config removed the error messages as well.
<oracle.manageddataaccess.client>
<version number="*">
<edmMappings>
<edmMapping dataType="number">
<add name="bool" precision="1" />
</edmMapping>
</edmMappings>
</version>
</oracle.manageddataaccess.client>

VS2010 development web server does not use integrated-mode HTTP handlers/modules

I am developing an ASP.NET MVC 2 web site, targeted for .NET Framework 4.0, using Visual Studio 2010.
My web.config contains the following code:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="XhtmlModule" type="DomenicDenicola.Website.XhtmlModule" />
</modules>
<handlers>
<add name="DotLess" type="dotless.Core.LessCssHttpHandler,dotless.Core" path="*.less" verb="*" />
</handlers>
</system.webServer>
When I use Build > Publish to put the web site on my local IIS7 instance, it works great.
However, when I use Debug > Start Debugging, neither the HTTP handler nor module are executed on any requests.
Strangely enough, when I put the handler and module <add /> tags back into <system.web /> under <httpHandlers /> and <httpModules />, they work. This seems to imply that the development web server is running in classic mode.
How do I fix this?
You don't. WebDev.WebServer.exe does not and cannot support integrated pipeline.
So, if you have code that cannot be written to perform in both environments you will need to use a local IIS for development.
Basically, system.web is the place to configure webdev server and IIS5-6 handlers and modules. system.webServer is for IIS7 handlers and modules, as you know.
Reference:
Each request in WebDev.WebHost40 (and previous versions) is processed by HttpRuntime.ProcessRequest
(which does not support integrated pipeline mode). This is the method used in all three versions of WebHost.WebServer.dll (the core of WebDev.WebServer.exe)
And the word of some dude who is fairly familiar with the inner workings of Cassini/WebDev by virtue of managing this project. ;-)
I'm not sure if I'm too late in answering, but while it's known fact that the Cassini server doesn't support integrated pipeline mode, you can still test locally using the classic pipeline by adding it to the httpModules section of system.web in your web.config:
<system.web>
<compilation debug="true" targetFramework="4.0"/>
.
.
.
<!-- HTTP Modules using Classic Pipeline -->
<httpModules>
<add name="YourHttpModule" type="ACME.YourHttpModule"/>
</httpModules>
</system.web>
<system.webServer>
<!-- HTTP Modules using Integrated Pipeline -->
<modules runAllManagedModulesForAllRequests="true">
<add name="YourHttpModule" type="ACME.YourHttpModule"/>
</modules>
</system.webServer>
You'd probably want to remove the httpModules section from your production web.config.
Got this today while running in visual studio 2012. Found the reason was visual studio launched the old web server that comes with 2010 and as explained above it can't work there. Changed to IIS Express by right click on properties, choose "Web" tab and and selecting IIS Express option. Then launching debug mode will start in IIS Express and this aparently supports operations such as Request.Headers.Add or whatever caused your exception.

where can i find SharedCache with fluent nhibernate getting started guid

where can i find SharedCache with fluent nhibernate getting started guid
There is very little documentation I've found for getting SharedCache working with NHibernate, let alone doing it fluently. However, it's not a hard process:
You need to tell NHibernate you're using SharedCache as a cache provider. Another Stack Overflow answer gives a sample implementation for Fluent NHibernate. The key bit is the Cache function, except here you will want to use NHibernate.Caches.SharedCache.SharedCacheProvider instead of NHibernate.Cache.HashtableCacheProvider.
As an aside, to configure it non fluently you use something like this in your configuration:
<add key="hibernate.cache.provider_class" value="NHibernate.Caches.SharedCache.SharedCacheProvider, NHibernate.Caches.SharedCache" />
Or, if you're configuring via Spring.NET with the rest of your NHibernate configuration entries:
<entry key="cache.provider_class" value="NHibernate.Caches.SharedCache.SharedCacheProvider, NHibernate.Caches.SharedCache" />
You will then need to add web.config / app.config entries for the cache as you would when using SharedCache without NHibernate, for example:
<configSections>
<section name="indexusNetSharedCache" type="MergeSystem.Indexus.WinServiceCommon.Configuration.Client.IndexusProviderSection, MergeSystem.Indexus.WinServiceCommon" />
</configSections>
<indexusNetSharedCache defaultProvider="IndexusSharedCacheProvider">
<servers>
<add key="myServer1" ipaddress="127.0.0.1" port="48888"/>
</servers>
<providers>
<add name="IndexusSharedCacheProvider" type="MergeSystem.Indexus.WinServiceCommon.Provider.Cache.IndexusSharedCacheProvider, MergeSystem.Indexus.WinServiceCommon" />
</providers>
</indexusNetSharedCache>
You can find plenty more information about configuring a SharedCache client on their website, although be sure to configure each server too.
Hope this helps - I haven't been able to fully test this, so I may've made a mistake somewhere.

Resources