diff --git a/Verax_API_EF/API/API.csproj b/Verax_API_EF/API/API.csproj
index 8e60ffc..8632b39 100644
--- a/Verax_API_EF/API/API.csproj
+++ b/Verax_API_EF/API/API.csproj
@@ -5,6 +5,7 @@
enable
enable
true
+ $(MSBuildProjectDirectory)
@@ -12,12 +13,17 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
diff --git a/Verax_API_EF/API/Program.cs b/Verax_API_EF/API/Program.cs
index d07947c..4b93a95 100644
--- a/Verax_API_EF/API/Program.cs
+++ b/Verax_API_EF/API/Program.cs
@@ -17,6 +17,8 @@ builder.Services.AddSwaggerGen();
builder.Services.AddDbContext();
builder.Services.AddScoped();
+builder.Services.AddScoped();
+builder.Services.AddScoped();
var app = builder.Build();
diff --git a/Verax_API_EF/API_DbDataManager/API_DbDataManager.csproj b/Verax_API_EF/API_DbDataManager/API_DbDataManager.csproj
index 098d5a6..a020201 100644
--- a/Verax_API_EF/API_DbDataManager/API_DbDataManager.csproj
+++ b/Verax_API_EF/API_DbDataManager/API_DbDataManager.csproj
@@ -5,11 +5,22 @@
enable
enable
DbDataManager
+ $(MSBuildProjectDirectory)
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/Verax_API_EF/API_DbDataManager/DbManager.cs b/Verax_API_EF/API_DbDataManager/DbManager.cs
new file mode 100644
index 0000000..6e4990b
--- /dev/null
+++ b/Verax_API_EF/API_DbDataManager/DbManager.cs
@@ -0,0 +1,12 @@
+using DbContextLib;
+
+namespace DbDataManager;
+
+public class DbManager
+{
+ protected LibraryContext _context;
+ public DbManager()
+ {
+ _context = new LibraryContext();
+ }
+}
\ No newline at end of file
diff --git a/Verax_API_EF/API_DbDataManager/DbManagerArticle.cs b/Verax_API_EF/API_DbDataManager/DbManagerArticle.cs
index 9d0d2fa..ca98ae5 100644
--- a/Verax_API_EF/API_DbDataManager/DbManagerArticle.cs
+++ b/Verax_API_EF/API_DbDataManager/DbManagerArticle.cs
@@ -11,7 +11,7 @@ public class DbManagerArticle : IArticleService
public DbManagerArticle(LibraryContext context)
{
- _context = context;
+ _context = new LibraryContext();
}
public async Task CreateArticle(long id, string title, string description, string author, string date, int lectureTime)
@@ -34,6 +34,7 @@ public class DbManagerArticle : IArticleService
public async Task DeleteArticle(long id)
{
var entity = _context.ArticleSet.FirstOrDefault(a => a.Id == id);
+ Console.WriteLine(entity);
if (entity == null) return null;
_context.ArticleSet.Remove(entity);
await _context.SaveChangesAsync();
@@ -61,6 +62,7 @@ public class DbManagerArticle : IArticleService
public async Task> GetAllArticles()
{
+ Console.WriteLine("GetAllArticles");
return await Task.FromResult(_context.ArticleSet.Select(a => a.ToModel()).AsEnumerable());
}
}
\ No newline at end of file
diff --git a/Verax_API_EF/Test_Console_EF/Entity_FrameWork.Article.db b/Verax_API_EF/API_DbDataManager/Entity_FrameWork.Article.db
similarity index 97%
rename from Verax_API_EF/Test_Console_EF/Entity_FrameWork.Article.db
rename to Verax_API_EF/API_DbDataManager/Entity_FrameWork.Article.db
index 1835087..becbb82 100644
Binary files a/Verax_API_EF/Test_Console_EF/Entity_FrameWork.Article.db and b/Verax_API_EF/API_DbDataManager/Entity_FrameWork.Article.db differ
diff --git a/Verax_API_EF/API_DbDataManager/Entity_FrameWork.Article.db-shm b/Verax_API_EF/API_DbDataManager/Entity_FrameWork.Article.db-shm
new file mode 100644
index 0000000..fe9ac28
Binary files /dev/null and b/Verax_API_EF/API_DbDataManager/Entity_FrameWork.Article.db-shm differ
diff --git a/Verax_API_EF/API_DbDataManager/Entity_FrameWork.Article.db-wal b/Verax_API_EF/API_DbDataManager/Entity_FrameWork.Article.db-wal
new file mode 100644
index 0000000..e69de29
diff --git a/Verax_API_EF/StubbedContextLib/Migrations/20240305073325_mrg1.Designer.cs b/Verax_API_EF/StubbedContextLib/Migrations/20240307182411_mrg1.Designer.cs
similarity index 99%
rename from Verax_API_EF/StubbedContextLib/Migrations/20240305073325_mrg1.Designer.cs
rename to Verax_API_EF/StubbedContextLib/Migrations/20240307182411_mrg1.Designer.cs
index c8caf18..1340e2b 100644
--- a/Verax_API_EF/StubbedContextLib/Migrations/20240305073325_mrg1.Designer.cs
+++ b/Verax_API_EF/StubbedContextLib/Migrations/20240307182411_mrg1.Designer.cs
@@ -10,7 +10,7 @@ using StubbedContextLib;
namespace StubbedContextLib.Migrations
{
[DbContext(typeof(StubbedContext))]
- [Migration("20240305073325_mrg1")]
+ [Migration("20240307182411_mrg1")]
partial class mrg1
{
///
@@ -149,7 +149,7 @@ namespace StubbedContextLib.Migrations
b.HasIndex("UserEntityId");
- b.ToTable("FormEntity");
+ b.ToTable("FormSet");
});
modelBuilder.Entity("Entities.UserEntity", b =>
diff --git a/Verax_API_EF/StubbedContextLib/Migrations/20240305073325_mrg1.cs b/Verax_API_EF/StubbedContextLib/Migrations/20240307182411_mrg1.cs
similarity index 95%
rename from Verax_API_EF/StubbedContextLib/Migrations/20240305073325_mrg1.cs
rename to Verax_API_EF/StubbedContextLib/Migrations/20240307182411_mrg1.cs
index 7cfb904..a40c540 100644
--- a/Verax_API_EF/StubbedContextLib/Migrations/20240305073325_mrg1.cs
+++ b/Verax_API_EF/StubbedContextLib/Migrations/20240307182411_mrg1.cs
@@ -72,7 +72,7 @@ namespace StubbedContextLib.Migrations
});
migrationBuilder.CreateTable(
- name: "FormEntity",
+ name: "FormSet",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
@@ -85,9 +85,9 @@ namespace StubbedContextLib.Migrations
},
constraints: table =>
{
- table.PrimaryKey("PK_FormEntity", x => x.Id);
+ table.PrimaryKey("PK_FormSet", x => x.Id);
table.ForeignKey(
- name: "FK_FormEntity_UserSet_UserEntityId",
+ name: "FK_FormSet_UserSet_UserEntityId",
column: x => x.UserEntityId,
principalTable: "UserSet",
principalColumn: "Id",
@@ -132,8 +132,8 @@ namespace StubbedContextLib.Migrations
column: "UserEntityId");
migrationBuilder.CreateIndex(
- name: "IX_FormEntity_UserEntityId",
- table: "FormEntity",
+ name: "IX_FormSet_UserEntityId",
+ table: "FormSet",
column: "UserEntityId");
}
@@ -144,7 +144,7 @@ namespace StubbedContextLib.Migrations
name: "ArticleUserEntity");
migrationBuilder.DropTable(
- name: "FormEntity");
+ name: "FormSet");
migrationBuilder.DropTable(
name: "ArticleSet");
diff --git a/Verax_API_EF/StubbedContextLib/Migrations/StubbedContextModelSnapshot.cs b/Verax_API_EF/StubbedContextLib/Migrations/StubbedContextModelSnapshot.cs
index 46de8e6..c4e950b 100644
--- a/Verax_API_EF/StubbedContextLib/Migrations/StubbedContextModelSnapshot.cs
+++ b/Verax_API_EF/StubbedContextLib/Migrations/StubbedContextModelSnapshot.cs
@@ -146,7 +146,7 @@ namespace StubbedContextLib.Migrations
b.HasIndex("UserEntityId");
- b.ToTable("FormEntity");
+ b.ToTable("FormSet");
});
modelBuilder.Entity("Entities.UserEntity", b =>