@manhng

Welcome to my blog!

Oracle + Entity Framework Core

January 31, 2021 09:13

Entity Framework Core + Oracle (edit)

  1. Update Model from Database...
  2. Generate Database from Model...

Entity Framework, LINQ and Model-First for the Oracle Database

https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/EntityFrameworkOBE/EntityFrameworkOBE.htm

Entity Framework Core tools reference - .NET Core CLI

https://docs.microsoft.com/en-us/ef/core/cli/dotnet

dotConnect for Oracle

https://www.devart.com/dotconnect/oracle/articles/efcore-database-first-net-core.html

Starting with an existing database

https://www.learnentityframeworkcore.com/walkthroughs/existing-database

Oracle DB First

https://www.devart.com/dotconnect/oracle/articles/efcore-database-first-net-core-entity-developer.html

Oracle Command - Inserting Data in Run Time

https://www.devart.com/dotconnect/oracle/articles/tutorial-command.html

To insert the first row into table dept you can use the following statement:

  1. CREATE TABLE dept:

    CREATE TABLE dept (
      deptno INT PRIMARY KEY,
      dname VARCHAR(14),
      loc VARCHAR(13)
    )
    
  2. CREATE TABLE emp:

    CREATE TABLE emp (
      empno INT PRIMARY KEY,
      ename VARCHAR(10),
      job VARCHAR(9),
      mgr INT,
      hiredate DATE,
      sal FLOAT,
      comm FLOAT,
      deptno INT REFERENCES dept
    )
INSERT INTO dept (deptno, dname, loc) VALUES (10,'Accounting','New York')

The following code fragment executes the query:

OracleConnection conn = new OracleConnection("User Id=scott;Password=tiger;Server=OraServer;");
OracleCommand cmd = new OracleCommand();
cmd.CommandText = "INSERT INTO dept (deptno, dname, loc) VALUES (10,'Accounting','New York')";
cmd.Connection = conn;
conn.Open();
try {
  int aff = cmd.ExecuteNonQuery();
  MessageBox.Show(aff + " rows were affected.");
}
catch {
  MessageBox.Show("Error encountered during INSERT operation.");
}
finally {
  conn.Close();
}

Console Application - How You Can Create a .NET Core Application Using Entity Framework Core with Oracle

https://www.talkingdotnet.com/create-net-core-application-using-entity-framework-core-with-oracle/

  1. Update Model From Database...
  2. Update Database from Model...
  3. Generate Database Script From Model...

Create a .NET Core Application Using Entity Framework Core with Oracle

ASP.NET Core Web API with Entity Framework Core

January 13, 2020 23:59

ASP.NET Core Web API with Entity Framework Core (edit)

CRUD Operation in ASP.NET Core Web API with Entity Framework Core

https://www.codeproject.com/Articles/1259484/CRUD-Operation-in-ASP-NET-Core-Web-API-with-Entity

https://github.com/mukeshkumartech/CRUD-AspNetCore-WebAPI

ASP.NET Core 2.1 - Implement Entity Framework Core In A Code First Approach

https://www.c-sharpcorner.com/article/entity-framework-core-a-code-first-approach/

ASP.NET Core Web API with EF Core DB-First Approach

https://code-maze.com/asp-net-core-web-api-with-ef-core-db-first-approach/

https://github.com/CodeMazeBlog/ef-db-first

How To Quickly Create A New Database Using EntityFramework Core On ASP.Net Core

CompatibilityVersion.Version_2_1

http://bekenty.com/entityframework-core-asp-net-core/

https://github.com/BekenJB/EmployeeManagerWithEFCore

Xóa bản ghi trùng lặp trong SQL Server Table

WITH student_cte AS (
    SELECT 
        First_Name, 
		Last_Name,
		Phone, 
        ROW_NUMBER() OVER(
            PARTITION BY 
                First_Name, 
                Last_Name, 
                Phone
            ORDER BY 
                First_Name, 
                Last_Name, 
                Phone
        ) rn
     FROM dbo.Students
)
select * from student_cte;
WITH student_cte AS (
    SELECT 
        First_Name, 
		Last_Name,
		Phone, 
        ROW_NUMBER() OVER(
            PARTITION BY 
                First_Name, 
                Last_Name, 
                Phone
            ORDER BY 
                First_Name, 
                Last_Name, 
                Phone
        ) rn
     FROM dbo.Students
)
DELETE FROM student_cte WHERE rn >1;

Categories

Recent posts