Compare commits
No commits in common. "b1f7fa53f8774ab86cfa107e158df68832fd07a4" and "550d53e9c764122750f9749e31a71b12b629d495" have entirely different histories.
b1f7fa53f8
...
550d53e9c7
3
.gitignore
vendored
3
.gitignore
vendored
@ -398,6 +398,3 @@ FodyWeavers.xsd
|
|||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
|
||||||
/Manarah.App/Manarah.db
|
|
||||||
/Manarah.App/Manarah.db-shm
|
|
||||||
/Manarah.App/Manarah.db-wal
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.3" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -8,11 +8,11 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Manarah.SqlServerMigrations.Migrations
|
namespace Manarah.App.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ManarahContext))]
|
[DbContext(typeof(ManarahContext))]
|
||||||
[Migration("20240505211647_InitCreate")]
|
[Migration("20240327205653_InitialCreate")]
|
||||||
partial class InitCreate
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
33
Manarah.App/Migrations/20240327205653_InitialCreate.cs
Normal file
33
Manarah.App/Migrations/20240327205653_InitialCreate.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Manarah.App.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitialCreate : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Server",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
IPAddress = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||||
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Server", x => x.IPAddress);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Server");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Manarah.SqlServerMigrations.Migrations
|
namespace Manarah.App.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ManarahContext))]
|
[DbContext(typeof(ManarahContext))]
|
||||||
partial class ManarahContextModelSnapshot : ModelSnapshot
|
partial class ManarahContextModelSnapshot : ModelSnapshot
|
@ -10,25 +10,12 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
|
|
||||||
var configuration = builder.Configuration;
|
builder.Services.AddDbContext<ManarahContext>(options =>
|
||||||
|
{
|
||||||
|
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"));
|
||||||
|
});
|
||||||
|
|
||||||
//Set db to Sqlite if as default db provider
|
//Register Service of typ Base Service for DI Container
|
||||||
var provider = configuration.GetValue("Provider", "Sqlite");
|
|
||||||
builder.Services.AddDbContext<ManarahContext>(
|
|
||||||
options => _ = provider switch
|
|
||||||
{
|
|
||||||
"Sqlite" => options.UseSqlite(
|
|
||||||
configuration.GetConnectionString("SqliteConnection"),
|
|
||||||
x => x.MigrationsAssembly("Manarah.SqliteMigrations")),
|
|
||||||
|
|
||||||
"SqlServer" => options.UseSqlServer(
|
|
||||||
configuration.GetConnectionString("SqlServerConnection"),
|
|
||||||
x => x.MigrationsAssembly("Manarah.SqlServerMigrations")),
|
|
||||||
|
|
||||||
_ => throw new Exception($"Unsupported provider: {provider}")
|
|
||||||
});
|
|
||||||
|
|
||||||
//Register Service of typ Base Service for DI
|
|
||||||
var assembly = Assembly.Load(typeof(BaseService).Assembly.FullName);
|
var assembly = Assembly.Load(typeof(BaseService).Assembly.FullName);
|
||||||
var serviceList = assembly.DefinedTypes.Where(d => d.BaseType == typeof(BaseService));
|
var serviceList = assembly.DefinedTypes.Where(d => d.BaseType == typeof(BaseService));
|
||||||
foreach (var service in serviceList)
|
foreach (var service in serviceList)
|
||||||
@ -46,7 +33,7 @@ if (!app.Environment.IsDevelopment())
|
|||||||
app.UseHsts();
|
app.UseHsts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<div class="small-box text-bg-danger">
|
<div class="small-box text-bg-danger">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<p>Unreachable servers</p>
|
<p>Unreachable servers</p>
|
||||||
<h3>@Model.Where(s => !s.IsReachable).Count()</h3>
|
<h3>@Model.Where(s => s.IsReachable).Count()</h3>
|
||||||
</div>
|
</div>
|
||||||
<svg class="small-box-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
<svg class="small-box-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||||
<path d="M4.5 5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1M3 4.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0" />
|
<path d="M4.5 5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1M3 4.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0" />
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"SqlServerConnection": "Server=localhost;Database=ManarahDb;Trusted_Connection=True;MultipleActiveResultSets=true;encrypt=false",
|
"DefaultConnection": "Server=localhost;Database=ManarahDb;Trusted_Connection=True;MultipleActiveResultSets=true;encrypt=false"
|
||||||
"SqliteConnection": "Data Source=Manarah.db;Cache=Shared"
|
|
||||||
},
|
},
|
||||||
"Provider": "Sqlite",
|
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<BaseOutputPath>..\Manarah.App\bin\</BaseOutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Manarah.App\Manarah.App.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,22 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Manarah.SqlServerMigrations.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class InitCreate : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<BaseOutputPath>..\Manarah.App\bin\</BaseOutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Manarah.App\Manarah.App.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,37 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using Manarah.App.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Manarah.SqliteMigrations.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ManarahContext))]
|
|
||||||
[Migration("20240505211518_InitCreate")]
|
|
||||||
partial class InitCreate
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.3");
|
|
||||||
|
|
||||||
modelBuilder.Entity("Manarah.Domain.Server", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("IPAddress")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("IPAddress");
|
|
||||||
|
|
||||||
b.ToTable("Server", (string)null);
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Manarah.SqliteMigrations.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class InitCreate : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using Manarah.App.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Manarah.SqliteMigrations.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ManarahContext))]
|
|
||||||
partial class ManarahContextModelSnapshot : ModelSnapshot
|
|
||||||
{
|
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.3");
|
|
||||||
|
|
||||||
modelBuilder.Entity("Manarah.Domain.Server", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("IPAddress")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("IPAddress");
|
|
||||||
|
|
||||||
b.ToTable("Server", (string)null);
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
22
Manarah.sln
22
Manarah.sln
@ -3,15 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.8.34525.116
|
VisualStudioVersion = 17.8.34525.116
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Manarah.App", "Manarah.App\Manarah.App.csproj", "{C505E413-CB8E-49A6-9186-AFDED3B878BD}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manarah.App", "Manarah.App\Manarah.App.csproj", "{C505E413-CB8E-49A6-9186-AFDED3B878BD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Manarah.Domain", "Manarah.Domain\Manarah.Domain.csproj", "{1551179E-FA6B-4E87-8B50-9FA2AD2F0CB0}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manarah.Domain", "Manarah.Domain\Manarah.Domain.csproj", "{1551179E-FA6B-4E87-8B50-9FA2AD2F0CB0}"
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Database", "Database", "{D07B611D-55F9-4830-949C-850677ED48EB}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Manarah.SqliteMigrations", "Manarah.SqliteMigrations\Manarah.SqliteMigrations.csproj", "{794BD3E8-AD7B-4C57-95E1-78CD0AA03DB8}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manarah.SqlServerMigrations", "Manarah.SqlServerMigrations\Manarah.SqlServerMigrations.csproj", "{DF9FC8BA-0854-465E-9C84-9FC330120527}"
|
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -27,22 +21,10 @@ Global
|
|||||||
{1551179E-FA6B-4E87-8B50-9FA2AD2F0CB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1551179E-FA6B-4E87-8B50-9FA2AD2F0CB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{1551179E-FA6B-4E87-8B50-9FA2AD2F0CB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1551179E-FA6B-4E87-8B50-9FA2AD2F0CB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1551179E-FA6B-4E87-8B50-9FA2AD2F0CB0}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1551179E-FA6B-4E87-8B50-9FA2AD2F0CB0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{794BD3E8-AD7B-4C57-95E1-78CD0AA03DB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{794BD3E8-AD7B-4C57-95E1-78CD0AA03DB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{794BD3E8-AD7B-4C57-95E1-78CD0AA03DB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{794BD3E8-AD7B-4C57-95E1-78CD0AA03DB8}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{DF9FC8BA-0854-465E-9C84-9FC330120527}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{DF9FC8BA-0854-465E-9C84-9FC330120527}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{DF9FC8BA-0854-465E-9C84-9FC330120527}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{DF9FC8BA-0854-465E-9C84-9FC330120527}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
|
||||||
{794BD3E8-AD7B-4C57-95E1-78CD0AA03DB8} = {D07B611D-55F9-4830-949C-850677ED48EB}
|
|
||||||
{DF9FC8BA-0854-465E-9C84-9FC330120527} = {D07B611D-55F9-4830-949C-850677ED48EB}
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {A3C4374E-F704-4D7C-88D0-BBEB231C39FC}
|
SolutionGuid = {A3C4374E-F704-4D7C-88D0-BBEB231C39FC}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
Loading…
Reference in New Issue
Block a user