First time i used 2 databases one for upload and save file and another one for user authentication and role management. But Now i want to use 1 database for both reason, Therefore i changed the edmx file and then
connection string in App.config file in Fileupload.data
<add name="JayBabaDBEntities" connectionString="metadata=res://*/baba.csdl|res://*/baba.ssdl|res://*/baba.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=JayBabaDB;persist security info=True;user id=sa;password=sa@12;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
And Connection string in Web.config file In FIleUpload.UI is
<add name="JayBabaDBEntities" connectionString="data source=.;initial catalog=JayBabaDB;persist security info=True;user id=sa;password=sa@12;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />
When i trying to login , it will check the user name and Password from Database. I added
baba.edmx
file in to Fileupload.data Here it is
namespace FileUpload.Data
{
public partial class JayBabaDBEntities : DbContext
{
public JayBabaDBEntities()
: base("name=JayBabaDBEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();`Exception occured here`
}
public DbSet<aspnet_Applications> aspnet_Applications { get; set; }
public DbSet<aspnet_Membership> aspnet_Membership { get; set; }
public DbSet<aspnet_Paths> aspnet_Paths { get; set; }
public DbSet<aspnet_PersonalizationAllUsers> aspnet_PersonalizationAllUsers { get; set; }
public DbSet<aspnet_PersonalizationPerUser> aspnet_PersonalizationPerUser { get; set; }
public DbSet<aspnet_Profile> aspnet_Profile { get; set; }
public DbSet<aspnet_Roles> aspnet_Roles { get; set; }
public DbSet<aspnet_SchemaVersions> aspnet_SchemaVersions { get; set; }
public DbSet<aspnet_Users> aspnet_Users { get; set; }
public DbSet<aspnet_WebEvent_Events> aspnet_WebEvent_Events { get; set; }
public DbSet<PaperPDFInfo> PaperPDFInfoes { get; set; }
public DbSet<UserQuery> UserQueries { get; set; }
public DbSet<UserRole> UserRoles { get; set; }
}
}
If i run Program and try to login , i will get following error
Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception.
So please help me to solve this error.