Im using The mysql driver 6.6.4 and EF 4.4.0.0. My context can create the database, It has also created a _MigrationHistory Table, i can insert, List, Delete records.
I can add an action with a create model, and auto create the model, everything is perfect
here is my context for claritty
public class MyContext : DbContext
{
static MyContext()
{
Database.SetInitializer<MyContext>(null);
}
public MyContext()
: base("Name=MyContext")
{
}
public DbSet<AdminUser> AdminUsers { get; set; }
public DbSet<Feedback> Feedbacks { get; set; }
public DbSet<Navigation> Navigations { get; set; }
public DbSet<SiteLink> SiteLinks { get; set; }
public DbSet<SiteNew> SiteNews { get; set; }
public DbSet<StockList> StockLists { get; set; }
public DbSet<SubNavigation> SubNavigations { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new AdminUserMap());
modelBuilder.Configurations.Add(new FeedbackMap());
modelBuilder.Configurations.Add(new NavigationMap());
modelBuilder.Configurations.Add(new SiteLinkMap());
modelBuilder.Configurations.Add(new SiteNewMap());
modelBuilder.Configurations.Add(new StockListMap());
modelBuilder.Configurations.Add(new SubNavigationMap());
}
my constring is the same name as my context, as said this all works. I have also added the Data Provider to my web.config file.
I Have even added some code in the create a stored procedure and this all works fine, bottom line everything looks really good here and as far as im concerned i have done everything right that i could possibly do.
but when I create a controller I get this: [ using the create controller with create, edit, delete options )

Now there is quite a bit of noise about this on here, and on the web but I have actually covered everything. I have even set my dbContext to just be DbSets and nothing else. This has been burning my head for quite some time now and I have done everything and read everything possible before making the move of asking on here.
Now I know this wuld probably be far easier with SQL Server etc etc, however i do not have that option, I have a very good mysql cluster and many sites using EF and code first, problems seem to start when I installed asp.net MVC 4 and upgraded to the latest .net.
Any ideas please, I will try anything
web.config
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="MyContext" connectionString="server=localhost;database=MyDB;user id=myuser; password=mypass; Pooling=false" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<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.6.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.6.4.0" newVersion="6.6.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</configuration>
model:
public class AdminUser
{
public int Id { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string Email { get; set; }
public short UserLevel { get; set; }
}
mapping
public class AdminUserMap : EntityTypeConfiguration<AdminUser>
{
public AdminUserMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.UserName)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.Password)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.Email)
.HasMaxLength(150);
// Table & Column Mappings
this.ToTable("AdminUsers", "eyebag");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.UserName).HasColumnName("UserName");
this.Property(t => t.Password).HasColumnName("Password");
this.Property(t => t.Email).HasColumnName("Email");
this.Property(t => t.UserLevel).HasColumnName("UserLevel");
}
}
well it seems that the simplest of solutions to this was to download the nuget package MvcScaffolding, and then use the MVCScaffolding version of add controller with EF create, edit, delete this version works and settles my problems, why the other option does not work will probably be unknown, but thanks for everyones help and sudgestions