Hỏi đáp

Chia sẻ kiến thức, cùng nhau phát triển

Mô hình 3 lớp kết hợp Entity Framework C#

23:07 10-04-2018 623 lượt xem 1 bình luận 01:09 11-04-2018

Trước hết cho em xin lỗi vì đã lập lại câu hỏi này. Em đã tìm và thấy câu hỏi này nhưng làm theo vẫn không được nên đành hỏi lại.

Em sử dụng mô hình 3 lớp (tạo 3 project)

Entity Framework em để ở lớp DataAcess.

Nhưng khi build lên thì thông báo lỗi System.InvalidOperationException: 'No connection string named 'dbQLKHOTHUOCEntities' could be found in the application config file.'

Em đã thử copy file app.config từ project DataAcess lên project GUI nhưng không thành công. xuất hiện tiếp lỗi 

System.InvalidOperationException: 'The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.'

trong dbQLKhoThuoc.Context.cs 

        public dbQLKHOTHUOCEntities()
            : base("name=dbQLKHOTHUOCEntities")
        {
        }

Mong được giúp đỡ ạ

Bình luận

Để bình luận, bạn cần đăng nhập bằng tài khoản Howkteam.

Đăng nhập
Nguyễn Thái Hải đã bình luận 01:09 11-04-2018

chưa có connectionString. Vô file config cấu hình đi bạn

Câu hỏi mới nhất