Entity Framework - Insert Update Delete View data in SQL Server using Three Tier | FoxLearn
Vložit
- čas přidán 7. 09. 2024
- Creating Three Tier Architecture using Entity Framework database first in C#. The C# Basics beginner course is a free C# Tutorial Series that helps beginning programmers learn the basics of the C# Programming Language. This is the best way to Learn C# for beginners
.net - How to create three tier solution for Entity framework
Entity Framework with 3-tier architecture
Using the Entity Framework in n-Tier Client-Side
Three-Tier Architecture using entity framework
How to Create Three Tier Architecture
3-tier architecture with entity framework
3-Tire Application Development Using Entity Framework
Website: foxlearn.com
This is one of the best educational tutorials about n-tier apps on internet. Thanks for uploading!!!
super example on using binding source. more example on binding source please with drop down list, master detail relations pls.
Nice Turorial thx a lot for you support.
Hello fox learn
I want to ask about the display data from more than one table to be used in printing queries
on report viewer
Thank you
Nice video, very useful for new developers.
Thank you so much :)
Wonderfull ! Thank you so much for sharing such a knowledge!
very good. thanks for everything
I have used the above code in MySQL. My table called Currency contains two properties, Unit and Rate but only unit is saving. Rate remains 0. I realize that my BindingSource.Current takes only Unit instead of taking both values.
Could you make a video (Insert, Update,Delete) with Entity Framework and Code First?
OK. Thank you for your suggestion. I'll make soon
Very Nice videos, like your learning style. Could you make more VB.Net videos? It is hard to find good vb videos.
OK. Thank you for your suggestion. I'll make soon
Hi, do you have some videos with EF Core and SQLite ? This would be really helpful. Like always great video.
I haven't got, i'll upload soon
Can you do a tutorial about searching using EF - 3Tier ?
i really need it.
Thx btw. This video is very useful
Ok, thank you for your suggestions
czcams.com/video/Ncbr5axCabM/video.html .I uploaded
NICE
HOW I CAN ADD TO THIS PROJECT A MASTER /DETAIL RELATION ?
thanks
Ok, Thank you for your suggestion. I'll make demo soon
Do you have a lesson where the same principle, but the connection is made through MySqlConnection?
No, I upload soon
Fox Learn ty
When I click "Save" on frmAddEditConatct nothing happens... I have revised my code multiple times and it's exactly as in the video. Do you have a link to download the full project?
Please check your code again. i'll upload to my site soon. thank you !
Hi. l designed a database, l want to know that, can we save the data in multi tables by clicking on one savebutton?
Yes, You can do that. You can view this video czcams.com/video/wAfF-MveMIk/video.html to know how to do that. Thank you
How can i run a stored procedure here, thanks
Hi Again , i can't find a Remove() , Add() ,Entry and Find method , i already add a reference System.data.entity , can you help me please ??
I think you should create a model context, then you can find Add, Remove, Entry... method
Bravo!!
Thank you !
Excelent tutorials! Could you send me the project please?
What is the instrument called 21:12?
if add one Users table have relationship many Contacts. You show how to CRUD data to two table. thank ! One problem DataAccessLayer includes InterfaceRepository but RepositoryLayer is beetwen DataLayer and BussinessLayer-> project structure is : Model, Repositories, Bussiness and Presentatiion Layer.
Link project of fox learn i rebuild www.mediafire.com/file/478ji41wkozc9kc/EF3Tiers.rar
How is the search done here?
good guide !
Thank you :)
You can make one video about CRUD Many to Many using EF. Example , I have three table are: Students(StudenID, StudentName); Courses(CourseID, CourseName) and StudentCourse(StudenID,CourseID). Students has many Courses and Courses has many Student. When i design in SQL server, i change many to many equal Students has one to many StudentCourse and Course has one to many StudentCourse=> I have 3 table in sql server. But in visual 2015 i create ado.net ef data created 2 table Students and Courses . linq to sql do not support many to many relationship. I can not create query CRUD join 3 tables. You can help me this problem! thank you so much.
Connection String :
Student.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace EFManyToMany
{
public class Student
{
[Key]
public int StudenID { get; set; }
public string StudentName { get; set; }
public IList Courses { get; set; }
}
}
Course.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace EFManyToMany
{
public class Course
{
[Key]
public int CourseID { get; set; }
public string CourseName { get; set; }
public IList Students { get; set; }
}
}
EmployeeDBContext.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
namespace EFManyToMany
{
public class EmployeeDBContext: DbContext
{
public EmployeeDBContext() : base("EmployeeDBContext")
{
Database.SetInitializer(new MigrateDatabaseToLatestVersion("EmployeeDBContext"));
}
public DbSet Courses { get; set; }
public DbSet Students { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity()
.HasMany(t => t.Courses)
.WithMany(t => t.Students)
.Map(m =>
{
m.ToTable("StudentCourses");
m.MapLeftKey("StudentID");
m.MapRightKey("CourseID");
});
base.OnModelCreating(modelBuilder);
}
}
}
Thêm dữ liệu vào các bảng:
USE Sample
GO
INSERT INTO dbo.Courses (CourseName) VALUES ( N'C#')
INSERT INTO dbo.Courses (CourseName) VALUES ( N'ASP.NET')
INSERT INTO dbo.Courses (CourseName) VALUES ( N'SQL Server')
INSERT INTO dbo.Courses (CourseName) VALUES ( N'WCF')
INSERT INTO dbo.Students ( StudentName ) VALUES ( N'Mike')
INSERT INTO dbo.Students ( StudentName ) VALUES ( N'John')
INSERT INTO dbo.StudentCourses VALUES ( N'1', N'1')
INSERT INTO dbo.StudentCourses VALUES ( N'1', N'2')
INSERT INTO dbo.StudentCourses VALUES ( N'2', N'1')
INSERT INTO dbo.StudentCourses VALUES ( N'2', N'2')
INSERT INTO dbo.StudentCourses VALUES ( N'2', N'3')
Hiển thị dữ liệu:
Cách 1:
using (EmployeeDBContext context = new EmployeeDBContext())
{
dataGridView1.DataSource = (from s in context.Students
from c in context.Courses
select new
{
StudentName = s.StudentName,
CourseName = c.CourseName
}).ToList();
}
Kết quả:
Cách 2:
EmployeeDBContext context = new EmployeeDBContext();
var stu_id = 1;
var query = from s in context.Students
where s.Courses.Any(c => c.CourseID == stu_id)
select s;
dataGridView1.DataSource = query.ToList();
Kết quả:
i like this tut, thank you, more...
can you add the source code link please
just like other channel do ;-)
Hi, What's your email? thank you
artc.jacob@gmail.com
Why don't you make video for separate select update delete and insert buttons operations. You are always creating data grid view with these operations
Thank you for your suggestion
Will be waiting for that
Dear sir,,What is code of save button ??
It has no code!
Why?? i ask same, i filled all textboxt in add form then i can't save nothing, what's the code
please how find you a references EntityFramwork.SqlServer.dll i can't find it ?! URGENT
Hi, You can install Entity Framework from nuget
can you send me the link please
Is Ok i find it thank u (y)
Code Pls
Hey man! what about a video with MySql, Entity Framework, MVVM in WPF and a trivial, step by step example that also the numbskulls among finally understand how to implement the freaking ViewModel. No-one has done this yet, so why don't you give it a try ;)
Ok. Thank you for your suggestion
Could you make a video (Insert, Update,Delete) with Entity Framework and Stored Procedures?
OK. Thank you for your suggestion. I'll make soon
Fox Learn oh thanks :)
code pleaes
Sent. Please check your email. Thank you