Entity Framework - Insert Update Delete View data in SQL Server using Three Tier | FoxLearn

Sdílet
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

Komentáře • 85

  • @crazyiso
    @crazyiso Před 7 lety +1

    This is one of the best educational tutorials about n-tier apps on internet. Thanks for uploading!!!

  • @mrt7948
    @mrt7948 Před 3 lety

    super example on using binding source. more example on binding source please with drop down list, master detail relations pls.

  • @brazo98
    @brazo98 Před 7 měsíci

    Nice Turorial thx a lot for you support.

  • @ermac9900
    @ermac9900 Před 7 lety +2

    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

  • @sdmunoz
    @sdmunoz Před 7 lety

    Nice video, very useful for new developers.

  • @2005Azm
    @2005Azm Před 6 lety

    Wonderfull ! Thank you so much for sharing such a knowledge!

  • @alicanhizlan4536
    @alicanhizlan4536 Před 6 lety +1

    very good. thanks for everything

  • @ntieng
    @ntieng Před 7 lety

    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.

  • @l3ecauseOfYou
    @l3ecauseOfYou Před 7 lety +1

    Could you make a video (Insert, Update,Delete) with Entity Framework and Code First?

    • @foxlearn
      @foxlearn  Před 7 lety +2

      OK. Thank you for your suggestion. I'll make soon

  • @ChristianHaugland74
    @ChristianHaugland74 Před 7 lety

    Very Nice videos, like your learning style. Could you make more VB.Net videos? It is hard to find good vb videos.

    • @foxlearn
      @foxlearn  Před 7 lety +1

      OK. Thank you for your suggestion. I'll make soon

  • @torchok19081986
    @torchok19081986 Před 7 lety

    Hi, do you have some videos with EF Core and SQLite ? This would be really helpful. Like always great video.

    • @foxlearn
      @foxlearn  Před 7 lety +1

      I haven't got, i'll upload soon

  • @tuandieu4523
    @tuandieu4523 Před 5 lety

    Can you do a tutorial about searching using EF - 3Tier ?
    i really need it.
    Thx btw. This video is very useful

    • @foxlearn
      @foxlearn  Před 5 lety

      Ok, thank you for your suggestions

    • @foxlearn
      @foxlearn  Před 5 lety

      czcams.com/video/Ncbr5axCabM/video.html .I uploaded

  • @dzconcept
    @dzconcept Před 7 lety +2

    NICE
    HOW I CAN ADD TO THIS PROJECT A MASTER /DETAIL RELATION ?
    thanks

    • @foxlearn
      @foxlearn  Před 7 lety

      Ok, Thank you for your suggestion. I'll make demo soon

  • @user-zn3fp8ll5v
    @user-zn3fp8ll5v Před 7 lety

    Do you have a lesson where the same principle, but the connection is made through MySqlConnection?

  • @NoThisIsntMyChannel
    @NoThisIsntMyChannel Před 5 lety

    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?

    • @foxlearn
      @foxlearn  Před 5 lety

      Please check your code again. i'll upload to my site soon. thank you !

  • @safiullah.amarkhail
    @safiullah.amarkhail Před 7 lety

    Hi. l designed a database, l want to know that, can we save the data in multi tables by clicking on one savebutton?

    • @foxlearn
      @foxlearn  Před 7 lety

      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

  • @awesomeasfucking
    @awesomeasfucking Před 4 lety

    How can i run a stored procedure here, thanks

  • @hichamkhadija1370
    @hichamkhadija1370 Před 7 lety

    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 ??

    • @foxlearn
      @foxlearn  Před 7 lety

      I think you should create a model context, then you can find Add, Remove, Entry... method

  • @codebuster2716
    @codebuster2716 Před 4 lety

    Bravo!!

  • @pablo1beroiza
    @pablo1beroiza Před 4 lety

    Excelent tutorials! Could you send me the project please?

  • @davidcedeno878
    @davidcedeno878 Před 6 lety

    What is the instrument called 21:12?

  • @MrNvQuy
    @MrNvQuy Před 7 lety +2

    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

  • @serkankisacik
    @serkankisacik Před 6 lety

    How is the search done here?

  • @MrNvQuy
    @MrNvQuy Před 7 lety

    good guide !

    • @foxlearn
      @foxlearn  Před 7 lety

      Thank you :)

    • @MrNvQuy
      @MrNvQuy Před 7 lety

      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ả:

  • @junarjacob9858
    @junarjacob9858 Před 7 lety

    i like this tut, thank you, more...
    can you add the source code link please
    just like other channel do ;-)

  • @danish9742
    @danish9742 Před 7 lety

    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

    • @foxlearn
      @foxlearn  Před 7 lety +1

      Thank you for your suggestion

    • @danish9742
      @danish9742 Před 7 lety

      Will be waiting for that

  • @darpanrelan4543
    @darpanrelan4543 Před 7 lety +1

    Dear sir,,What is code of save button ??

  • @hichamkhadija1370
    @hichamkhadija1370 Před 7 lety

    please how find you a references EntityFramwork.SqlServer.dll i can't find it ?! URGENT

  • @serhatsabah5430
    @serhatsabah5430 Před rokem

    Code Pls

  • @GonzoGonschi
    @GonzoGonschi Před 7 lety

    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 ;)

    • @foxlearn
      @foxlearn  Před 7 lety

      Ok. Thank you for your suggestion

  • @1995thebama
    @1995thebama Před 7 lety

    Could you make a video (Insert, Update,Delete) with Entity Framework and Stored Procedures?

    • @foxlearn
      @foxlearn  Před 7 lety +2

      OK. Thank you for your suggestion. I'll make soon

    • @1995thebama
      @1995thebama Před 7 lety

      Fox Learn oh thanks :)

  • @mohammadaziz150
    @mohammadaziz150 Před 7 lety

    code pleaes

    • @foxlearn
      @foxlearn  Před 7 lety

      Sent. Please check your email. Thank you