Add project files.

This commit is contained in:
2023-04-17 11:01:23 +02:00
parent 7a71f95529
commit 0234db870b
25 changed files with 987 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-preview.3.23174.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0-preview.3.23174.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0-preview.3.23174.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Client\BlazorSyncfusionCrm.Client.csproj" />
<ProjectReference Include="..\Shared\BlazorSyncfusionCrm.Shared.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,64 @@
using BlazorSyncfusionCrm.Shared;
using Microsoft.EntityFrameworkCore;
namespace BlazorSyncfusionCrm.Server.Data
{
public class DataContext : DbContext
{
public DataContext(DbContextOptions<DataContext> options) : base(options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder
.UseSqlServer("Server=oemansv7win;Database=blazingcrm;User Id=sa;Password=SAoemansv7winSA;TrustServerCertificate=true");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Contact>().HasData(
new Contact
{
Id = 1,
FirstName = "Peter",
LastName = "Parker",
NickName = "Spider-Man",
Place = "New York City",
DateOfBirth = new DateTime(2001, 8, 1),
DateCreated = DateTime.Now
},
new Contact
{
Id = 2,
FirstName = "Tony",
LastName = "Stark",
NickName = "Iron Man",
Place = "Malibu",
DateOfBirth = new DateTime(1970, 5, 29),
DateCreated = DateTime.Now
},
new Contact
{
Id = 3,
FirstName = "Bruce",
LastName = "Wayne",
NickName = "Batman",
Place = "Gotham City",
DateOfBirth = new DateTime(1915, 4, 7),
DateCreated = DateTime.Now
}
);
modelBuilder.Entity<Note>().HasData(
new Note { Id = 1,ContactId = 1,Text="With great power comes great responsibility."},
new Note { Id = 2, ContactId = 2, Text = "I'm Iron Man." },
new Note { Id = 3, ContactId = 3, Text = "I'm Batman!." }
);
}
public DbSet<Contact> Contacts { get; set; }
public DbSet<Note> Notes { get; set; }
}
}

View File

@ -0,0 +1,177 @@
// <auto-generated />
using System;
using BlazorSyncfusionCrm.Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BlazorSyncfusionCrm.Server.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230417080830_Initial")]
partial class Initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.3.23174.2")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BlazorSyncfusionCrm.Shared.Contact", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime2");
b.Property<DateTime>("DateDeleted")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateOfBirth")
.HasColumnType("datetime2");
b.Property<DateTime>("DateUpdated")
.HasColumnType("datetime2");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("NickName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Place")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Contacts");
b.HasData(
new
{
Id = 1,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6043),
DateDeleted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateOfBirth = new DateTime(2001, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
FirstName = "Peter",
IsDeleted = false,
LastName = "Parker",
NickName = "Spider-Man",
Place = "New York City"
},
new
{
Id = 2,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6047),
DateDeleted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateOfBirth = new DateTime(1970, 5, 29, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
FirstName = "Tony",
IsDeleted = false,
LastName = "Stark",
NickName = "Iron Man",
Place = "Malibu"
},
new
{
Id = 3,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6050),
DateDeleted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateOfBirth = new DateTime(1915, 4, 7, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
FirstName = "Bruce",
IsDeleted = false,
LastName = "Wayne",
NickName = "Batman",
Place = "Gotham City"
});
});
modelBuilder.Entity("BlazorSyncfusionCrm.Shared.Note", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("ContactId")
.HasColumnType("int");
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime2");
b.Property<string>("Text")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ContactId");
b.ToTable("Notes");
b.HasData(
new
{
Id = 1,
ContactId = 1,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6341),
Text = "With great power comes great responsibility."
},
new
{
Id = 2,
ContactId = 2,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6345),
Text = "I'm Iron Man."
},
new
{
Id = 3,
ContactId = 3,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6346),
Text = "I'm Batman!."
});
});
modelBuilder.Entity("BlazorSyncfusionCrm.Shared.Note", b =>
{
b.HasOne("BlazorSyncfusionCrm.Shared.Contact", "Contact")
.WithMany("Notes")
.HasForeignKey("ContactId");
b.Navigation("Contact");
});
modelBuilder.Entity("BlazorSyncfusionCrm.Shared.Contact", b =>
{
b.Navigation("Notes");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,93 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace BlazorSyncfusionCrm.Server.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Contacts",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
NickName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Place = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
DateOfBirth = table.Column<DateTime>(type: "datetime2", nullable: true),
DateCreated = table.Column<DateTime>(type: "datetime2", nullable: false),
DateUpdated = table.Column<DateTime>(type: "datetime2", nullable: false),
DateDeleted = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Contacts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Notes",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Text = table.Column<string>(type: "nvarchar(max)", nullable: false),
ContactId = table.Column<int>(type: "int", nullable: true),
DateCreated = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Notes", x => x.Id);
table.ForeignKey(
name: "FK_Notes_Contacts_ContactId",
column: x => x.ContactId,
principalTable: "Contacts",
principalColumn: "Id");
});
migrationBuilder.InsertData(
table: "Contacts",
columns: new[] { "Id", "DateCreated", "DateDeleted", "DateOfBirth", "DateUpdated", "FirstName", "IsDeleted", "LastName", "NickName", "Place" },
values: new object[,]
{
{ 1, new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6043), new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2001, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Peter", false, "Parker", "Spider-Man", "New York City" },
{ 2, new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6047), new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(1970, 5, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Tony", false, "Stark", "Iron Man", "Malibu" },
{ 3, new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6050), new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(1915, 4, 7, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Bruce", false, "Wayne", "Batman", "Gotham City" }
});
migrationBuilder.InsertData(
table: "Notes",
columns: new[] { "Id", "ContactId", "DateCreated", "Text" },
values: new object[,]
{
{ 1, 1, new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6341), "With great power comes great responsibility." },
{ 2, 2, new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6345), "I'm Iron Man." },
{ 3, 3, new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6346), "I'm Batman!." }
});
migrationBuilder.CreateIndex(
name: "IX_Notes_ContactId",
table: "Notes",
column: "ContactId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Notes");
migrationBuilder.DropTable(
name: "Contacts");
}
}
}

View File

@ -0,0 +1,174 @@
// <auto-generated />
using System;
using BlazorSyncfusionCrm.Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BlazorSyncfusionCrm.Server.Migrations
{
[DbContext(typeof(DataContext))]
partial class DataContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0-preview.3.23174.2")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BlazorSyncfusionCrm.Shared.Contact", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime2");
b.Property<DateTime>("DateDeleted")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateOfBirth")
.HasColumnType("datetime2");
b.Property<DateTime>("DateUpdated")
.HasColumnType("datetime2");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("NickName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Place")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Contacts");
b.HasData(
new
{
Id = 1,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6043),
DateDeleted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateOfBirth = new DateTime(2001, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
FirstName = "Peter",
IsDeleted = false,
LastName = "Parker",
NickName = "Spider-Man",
Place = "New York City"
},
new
{
Id = 2,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6047),
DateDeleted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateOfBirth = new DateTime(1970, 5, 29, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
FirstName = "Tony",
IsDeleted = false,
LastName = "Stark",
NickName = "Iron Man",
Place = "Malibu"
},
new
{
Id = 3,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6050),
DateDeleted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateOfBirth = new DateTime(1915, 4, 7, 0, 0, 0, 0, DateTimeKind.Unspecified),
DateUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
FirstName = "Bruce",
IsDeleted = false,
LastName = "Wayne",
NickName = "Batman",
Place = "Gotham City"
});
});
modelBuilder.Entity("BlazorSyncfusionCrm.Shared.Note", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("ContactId")
.HasColumnType("int");
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime2");
b.Property<string>("Text")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ContactId");
b.ToTable("Notes");
b.HasData(
new
{
Id = 1,
ContactId = 1,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6341),
Text = "With great power comes great responsibility."
},
new
{
Id = 2,
ContactId = 2,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6345),
Text = "I'm Iron Man."
},
new
{
Id = 3,
ContactId = 3,
DateCreated = new DateTime(2023, 4, 17, 10, 8, 30, 665, DateTimeKind.Local).AddTicks(6346),
Text = "I'm Batman!."
});
});
modelBuilder.Entity("BlazorSyncfusionCrm.Shared.Note", b =>
{
b.HasOne("BlazorSyncfusionCrm.Shared.Contact", "Contact")
.WithMany("Notes")
.HasForeignKey("ContactId");
b.Navigation("Contact");
});
modelBuilder.Entity("BlazorSyncfusionCrm.Shared.Contact", b =>
{
b.Navigation("Notes");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,33 @@
using BlazorSyncfusionCrm.Server.Data;
using Microsoft.AspNetCore.ResponseCompression;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews();
builder.Services.AddRazorPages();
builder.Services.AddDbContext<DataContext>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseWebAssemblyDebugging();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseBlazorFrameworkFiles();
app.UseStaticFiles();
app.UseRouting();
app.MapRazorPages();
app.MapControllers();
app.MapFallbackToFile("index.html");
app.Run();

View File

@ -0,0 +1,44 @@
{
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5229"
},
"https": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7031;http://localhost:5229"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
}
},
"iisExpress": {
"applicationUrl": "http://localhost:57610",
"sslPort": 44334
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53859/",
"sslPort": 44311
}
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}