Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Iam Using EntityFrameWork Code First
But I Have DataBase And Not Create DataBase
How To Solve Proble
This My Code Create It

Iam Tired This Is My Code
In DAL
C#
namespace DAL
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;
    public class TurboTec:DbContext
    {
        public TurboTec()
            :base("name=TurboTec")
        {
        }
        public System.Data.Entity.DbSet<Entities.EF.CompEff> CompEffS { get; set; }
        public System.Data.Entity.DbSet<Entities.EF.dehagh_data> dehagh_dataS { get; set; }
        public System.Data.Entity.DbSet<Entities.EF.dehagh_Tags> dehagh_TagsS { get; set; }
        public System.Data.Entity.DbSet<Entities.EF.HealthyMap> HealthyMapS { get; set; }
        public System.Data.Entity.DbSet<Entities.EF.MaintGeneral> MaintGeneralS { get; set; }
        public System.Data.Entity.DbSet<Entities.EF.MaintOperation> MaintOperationS { get; set; }
        public System.Data.Entity.DbSet<Entities.EF.MaintRoutine> MaintRoutineS { get; set; }
        public System.Data.Entity.DbSet<Entities.EF.Trends> TrendsS { get; set; }
    }
}


In App.Config :
<connectionstrings>
<add name="TurboTec">
connectionString="data source=.;initial catalog="C:\USERS\B.EBRAHIMI\DESKTOP\TOTAL SOLUTION\DXAPPLICATION2\BIN\DEBUG\DEHAGH.MDF";integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"
providerName="System.Data.SqlClient" />


What I have tried:

Iam Tired Above Code And Error This
Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations
Posted
Updated 14-Aug-16 0:50am
v2
Comments
njammy 15-Aug-16 6:43am    
What is the "name" attribute of your connection string set to?
Nathan Minier 15-Aug-16 9:05am    
Possibilities:
1. It's not finding the database. Is your Data Source correct?
2. Your account does not have dbcreator permissions set. Use an account that does.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900