Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvik Mazumder committed Nov 30, 2021
1 parent cff6e7c commit 437db1e
Show file tree
Hide file tree
Showing 68 changed files with 15,962 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Library.Encyclopedia.API.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29806.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library.Encyclopedia", "Library.Encyclopedia\Library.Encyclopedia.csproj", "{9EB0F02C-FB4B-4AEB-9879-D9BB7B2C2081}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library.Encyclopedia.Entity", "Library.Encyclopedia.Entity\Library.Encyclopedia.Entity.csproj", "{00243580-2623-4E3C-8299-65C91E7CEC98}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library.Encyclopedia.DataAccess", "Library.Encyclopedia.DataAccess\Library.Encyclopedia.DataAccess.csproj", "{759EFC47-D4A9-4214-87D2-DC2A4699D2D2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9EB0F02C-FB4B-4AEB-9879-D9BB7B2C2081}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9EB0F02C-FB4B-4AEB-9879-D9BB7B2C2081}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EB0F02C-FB4B-4AEB-9879-D9BB7B2C2081}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9EB0F02C-FB4B-4AEB-9879-D9BB7B2C2081}.Release|Any CPU.Build.0 = Release|Any CPU
{00243580-2623-4E3C-8299-65C91E7CEC98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00243580-2623-4E3C-8299-65C91E7CEC98}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00243580-2623-4E3C-8299-65C91E7CEC98}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00243580-2623-4E3C-8299-65C91E7CEC98}.Release|Any CPU.Build.0 = Release|Any CPU
{759EFC47-D4A9-4214-87D2-DC2A4699D2D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{759EFC47-D4A9-4214-87D2-DC2A4699D2D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{759EFC47-D4A9-4214-87D2-DC2A4699D2D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{759EFC47-D4A9-4214-87D2-DC2A4699D2D2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {370FA4D8-EDF9-4F00-BC2A-EBDF16892AD6}
EndGlobalSection
EndGlobal
25 changes: 25 additions & 0 deletions Library.Encyclopedia.DataAccess/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Library.Encyclopedia.Entity.Models;
using Microsoft.EntityFrameworkCore;
using System.Threading.Tasks;

namespace Library.Encyclopedia.DataAccess
{
public class ApplicationDbContext : DbContext, IApplicationDbContext
{
private const string connectionString = "Server=localhost\\SQLEXPRESS01;Database=Encyclopedia;Trusted_Connection=True;";

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(connectionString);
}

public DbSet<Main> Main { get; set; }
public DbSet<Files> Files { get; set; }
public DbSet<Links> Links { get; set; }

public new async Task<int> SaveChanges()
{
return await base.SaveChangesAsync();
}
}
}
37 changes: 37 additions & 0 deletions Library.Encyclopedia.DataAccess/DataAccess/MainDataAccess.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Library.Encyclopedia.Entity.Interfaces;
using Library.Encyclopedia.Entity.Models;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Library.Encyclopedia.DataAccess.DataAccess
{
public class MainDataAccess : IMainDataAccess
{
public MainDataAccess()
{

}

Task<IEnumerable<Main>> IMainDataAccess.Get(string query, int offset, int pagesize, bool ascending)
{
throw new NotImplementedException();
}

Task<Main> IMainDataAccess.Get(string id)
{
throw new NotImplementedException();
}

Task<IEnumerable<Main>> IMainDataAccess.Get(char startingAlphabet)
{
throw new NotImplementedException();
}

Task<IEnumerable<Main>> IMainDataAccess.GetByCategory(string category, int offset, int pagesize, bool ascending)
{
throw new NotImplementedException();
}
}
}
14 changes: 14 additions & 0 deletions Library.Encyclopedia.DataAccess/IApplicationDbContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Library.Encyclopedia.Entity.Models;
using Microsoft.EntityFrameworkCore;
using System.Threading.Tasks;

namespace Library.Encyclopedia.DataAccess
{
public interface IApplicationDbContext
{
DbSet<Main> Main { get; set; }
DbSet<Files> Files { get; set; }
DbSet<Links> Links { get; set; }
Task<int> SaveChanges();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.12">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.12">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Library.Encyclopedia.Entity\Library.Encyclopedia.Entity.csproj" />
</ItemGroup>

</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace Library.Encyclopedia.DataAccess.Migrations
{
public partial class NewDatabase : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Main",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
Category = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Main", x => x.Id);
});

migrationBuilder.CreateTable(
name: "Files",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
MainId = table.Column<string>(type: "nvarchar(450)", nullable: true),
FileName = table.Column<string>(type: "nvarchar(max)", nullable: true),
FileType = table.Column<string>(type: "nvarchar(max)", nullable: true),
FileDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
FilePath = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Files", x => x.Id);
table.ForeignKey(
name: "FK_Files_Main_MainId",
column: x => x.MainId,
principalTable: "Main",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});

migrationBuilder.CreateTable(
name: "Links",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
MainId = table.Column<string>(type: "nvarchar(450)", nullable: true),
Link = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsInternal = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Links", x => x.Id);
table.ForeignKey(
name: "FK_Links_Main_MainId",
column: x => x.MainId,
principalTable: "Main",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});

migrationBuilder.CreateIndex(
name: "IX_Files_MainId",
table: "Files",
column: "MainId");

migrationBuilder.CreateIndex(
name: "IX_Links_MainId",
table: "Links",
column: "MainId");
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Files");

migrationBuilder.DropTable(
name: "Links");

migrationBuilder.DropTable(
name: "Main");
}
}
}
Loading

0 comments on commit 437db1e

Please sign in to comment.