Skip to content

Commit b852c02

Browse files
committed
Baseline for Demo
1 parent 254a225 commit b852c02

35 files changed

+391
-39
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ ServiceFabricBackup/
262262
*.rptproj.bak
263263

264264
# SQL Server files
265-
*.mdf
266-
*.ldf
267-
*.ndf
265+
#*.mdf
266+
#*.ldf
267+
#*.ndf
268268

269269
# Business Intelligence projects
270270
*.rdl.data

Demos/LicenseTrack/AppCode/.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ ServiceFabricBackup/
262262
*.rptproj.bak
263263

264264
# SQL Server files
265-
*.mdf
266-
*.ldf
267-
*.ndf
265+
#*.mdf
266+
#*.ldf
267+
#*.ndf
268268

269269
# Business Intelligence projects
270270
*.rdl.data
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Demo.LicenseTrack.App.Model
6+
{
7+
/// <summary>
8+
/// Message information to be displayed in a dialog.
9+
/// </summary>
10+
public class DialogMessage
11+
{
12+
public string Message { get; set; }
13+
public string Title { get; set; }
14+
}
15+
}

Demos/LicenseTrack/AppCode/Demo.LicenseTrack.App.Model/LibraryLoader.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ protected override void LoadManualRegistration(IServiceCollection serviceCollect
3434
}
3535

3636

37+
38+
3739
/// <summary>
38-
/// Loads transient service registrations with the hosting DI container.
40+
/// Automated registration of classes using transient registration.
3941
/// </summary>
40-
/// <param name="serviceCollection">The dependency injection provider to register services with.</param>
41-
/// <param name="configuration">The source configuration to provide for dependency injection.</param>
42+
/// <param name="serviceCollection">The service collection to register services.</param>
43+
/// <param name="configuration">The configuration data used with register of services.</param>
4244
protected override void LoadRegistration(IServiceCollection serviceCollection, IConfiguration configuration)
4345
{
4446
//Intentionally blank
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Demo.LicenseTrack.App.Model
6+
{
7+
/// <summary>
8+
/// Data class that provides the results from a <see cref="PageDataRequest"/>.
9+
/// </summary>
10+
/// <typeparam name="T">The target type of the data model to be returned.</typeparam>
11+
public class PageDataResponse<T> where T : class
12+
{
13+
/// <summary>
14+
/// The total number of records in the full query results.
15+
/// </summary>
16+
public int TotalCount { get; set; }
17+
18+
/// <summary>
19+
/// The data results from the paging request.
20+
/// </summary>
21+
public List<T> Results { get; set; } = new List<T>();
22+
}
23+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Demo.LicenseTrack.App.Model
6+
{
7+
/// <summary>
8+
/// Data class that captures information needed for a set size page of data.
9+
/// </summary>
10+
public class PageDataRequest
11+
{
12+
/// <summary>
13+
/// The page number to return.
14+
/// </summary>
15+
public int Page { get; set; }
16+
17+
/// <summary>
18+
/// The number of records for a page.
19+
/// </summary>
20+
public int PageSize { get; set; }
21+
22+
/// <summary>
23+
/// Optional property that determines the text to be search for on all supported fields.
24+
/// </summary>
25+
public string Search { get; set; }
26+
27+
/// <summary>
28+
/// Optional property that provides a list of fields to be sorted and the sort direction.
29+
/// </summary>
30+
public List<SortingDirection> FieldsSorting { get; set; } = new List<SortingDirection>();
31+
}
32+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Demo.LicenseTrack.App.Model
6+
{
7+
/// <summary>
8+
/// Data class to provide sort direction for fields on grid.
9+
/// </summary>
10+
public class SortingDirection
11+
{
12+
/// <summary>
13+
/// Field being sorted
14+
/// </summary>
15+
public string FieldName { get; set; }
16+
17+
/// <summary>
18+
/// Is the field in descending direction
19+
/// </summary>
20+
public bool IsDesc { get; set; }
21+
}
22+
}

Demos/LicenseTrack/AppCode/Demo.LicenseTrack.Client.Transport.Rest/Demo.LicenseTrack.Client.Transport.Rest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
<ItemGroup>
1414
<ProjectReference Include="..\Demo.LicenseTrack.App.Model\Demo.LicenseTrack.App.Model.csproj" />
15+
<ProjectReference Include="..\Demo.LicenseTrack.Client.Contracts\Demo.LicenseTrack.Client.Contracts.csproj" />
1516
<ProjectReference Include="..\Demo.LicenseTrack.Transport.Rest.Model\Demo.LicenseTrack.Transport.Rest.Model.csproj" />
1617
</ItemGroup>
1718

Demos/LicenseTrack/AppCode/Demo.LicenseTrack.Client.Transport.Rest/LibraryLoader.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ protected override void LoadManualRegistration(IServiceCollection serviceCollect
3434
}
3535

3636

37+
3738
/// <summary>
38-
/// Loads transient service registrations with the hosting DI container.
39+
/// Automated registration of classes using transient registration.
3940
/// </summary>
40-
/// <param name="serviceCollection">The dependency injection provider to register services with.</param>
41-
/// <param name="configuration">The source configuration to provide for dependency injection.</param>
41+
/// <param name="serviceCollection">The service collection to register services.</param>
42+
/// <param name="configuration">The configuration data used with register of services.</param>
4243
protected override void LoadRegistration(IServiceCollection serviceCollection, IConfiguration configuration)
4344
{
4445
//Intentionally blank
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Text.Json.Serialization;
7+
8+
namespace Demo.LicenseTrack.Client.Transport.Rest
9+
{
10+
/// <summary>
11+
/// A machine-readable format for specifying errors in HTTP API responses based on <see href="https://tools.ietf.org/html/rfc7807"/>.
12+
/// </summary>
13+
/// <remarks> Directly cloned from <see href="https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http.Abstractions/src/ProblemDetails/ProblemDetails.cs"/> No changes were made to this code. This code file is from the .net foundation used under the MIT license.</remarks>
14+
public class ProblemDetails
15+
{
16+
/// <summary>
17+
/// A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when
18+
/// dereferenced, it provide human-readable documentation for the problem type
19+
/// (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not present, its value is assumed to be
20+
/// "about:blank".
21+
/// </summary>
22+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
23+
[JsonPropertyOrder(-5)]
24+
public string? Type { get; set; }
25+
26+
/// <summary>
27+
/// A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence
28+
/// of the problem, except for purposes of localization(e.g., using proactive content negotiation;
29+
/// see[RFC7231], Section 3.4).
30+
/// </summary>
31+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
32+
[JsonPropertyOrder(-4)]
33+
public string? Title { get; set; }
34+
35+
/// <summary>
36+
/// The HTTP status code([RFC7231], Section 6) generated by the origin server for this occurrence of the problem.
37+
/// </summary>
38+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
39+
[JsonPropertyOrder(-3)]
40+
public int? Status { get; set; }
41+
42+
/// <summary>
43+
/// A human-readable explanation specific to this occurrence of the problem.
44+
/// </summary>
45+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
46+
[JsonPropertyOrder(-2)]
47+
public string? Detail { get; set; }
48+
49+
/// <summary>
50+
/// A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
51+
/// </summary>
52+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
53+
[JsonPropertyOrder(-1)]
54+
public string? Instance { get; set; }
55+
56+
/// <summary>
57+
/// Gets the <see cref="IDictionary{TKey, TValue}"/> for extension members.
58+
/// <para>
59+
/// Problem type definitions MAY extend the problem details object with additional members. Extension members appear in the same namespace as
60+
/// other members of a problem type.
61+
/// </para>
62+
/// </summary>
63+
/// <remarks>
64+
/// The round-tripping behavior for <see cref="Extensions"/> is determined by the implementation of the Input \ Output formatters.
65+
/// In particular, complex types or collection types may not round-trip to the original type when using the built-in JSON or XML formatters.
66+
/// </remarks>
67+
[JsonExtensionData]
68+
public IDictionary<string, object?> Extensions { get; set; } = new Dictionary<string, object?>(StringComparer.Ordinal);
69+
}
70+
}

Demos/LicenseTrack/AppCode/Demo.LicenseTrack.Data.Sql.Model/Class1.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Scaffold-DbContext 'Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\github\codefactoryllc\CodeFactoryPackages\Demos\LicenseTrack\AppCode\Demo.LicenseTrack.Transport.Rest\LicenseTrack.mdf;Integrated Security=True' Microsoft.EntityFrameworkCore.SqlServer -context LicenseTrackContext -NoOnConfiguring -DataAnnotations -Force
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Microsoft.EntityFrameworkCore;
4+
5+
namespace Demo.LicenseTrack.Data.Sql.Model;
6+
7+
public partial class LicenseTrackContext : DbContext
8+
{
9+
public LicenseTrackContext(DbContextOptions<LicenseTrackContext> options)
10+
: base(options)
11+
{
12+
}
13+
14+
public virtual DbSet<TblCustomer> TblCustomers { get; set; }
15+
16+
public virtual DbSet<TblLicense> TblLicenses { get; set; }
17+
18+
protected override void OnModelCreating(ModelBuilder modelBuilder)
19+
{
20+
modelBuilder.Entity<TblCustomer>(entity =>
21+
{
22+
entity.HasKey(e => e.Id).HasName("PK__TblCusto__3214EC070C92737E");
23+
24+
entity.Property(e => e.Id).ValueGeneratedNever();
25+
});
26+
27+
modelBuilder.Entity<TblLicense>(entity =>
28+
{
29+
entity.HasKey(e => e.Id).HasName("PK__TblLicen__3214EC07BF23D964");
30+
31+
entity.Property(e => e.Id).ValueGeneratedNever();
32+
});
33+
34+
OnModelCreatingPartial(modelBuilder);
35+
}
36+
37+
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
38+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.ComponentModel.DataAnnotations.Schema;
5+
using Microsoft.EntityFrameworkCore;
6+
7+
namespace Demo.LicenseTrack.Data.Sql.Model;
8+
9+
[Table("TblCustomer")]
10+
public partial class TblCustomer
11+
{
12+
[Key]
13+
public int Id { get; set; }
14+
15+
[StringLength(100)]
16+
public string FirstName { get; set; } = null!;
17+
18+
[StringLength(100)]
19+
public string LastName { get; set; } = null!;
20+
21+
[StringLength(100)]
22+
public string MiddleName { get; set; } = null!;
23+
24+
[StringLength(100)]
25+
public string Email { get; set; } = null!;
26+
27+
[StringLength(512)]
28+
public string? Address { get; set; }
29+
30+
[StringLength(512)]
31+
public string? Address2 { get; set; }
32+
33+
[StringLength(255)]
34+
public string? City { get; set; }
35+
36+
[StringLength(10)]
37+
public string? State { get; set; }
38+
39+
[StringLength(20)]
40+
public string? PostalCode { get; set; }
41+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.ComponentModel.DataAnnotations.Schema;
5+
using Microsoft.EntityFrameworkCore;
6+
7+
namespace Demo.LicenseTrack.Data.Sql.Model;
8+
9+
[Table("TblLicense")]
10+
public partial class TblLicense
11+
{
12+
[Key]
13+
public int Id { get; set; }
14+
15+
public int CustomerId { get; set; }
16+
17+
[StringLength(1024)]
18+
public string License { get; set; } = null!;
19+
20+
public DateTime ExpirationDate { get; set; }
21+
}

Demos/LicenseTrack/AppCode/Demo.LicenseTrack.Data.Sql/Class1.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

Demos/LicenseTrack/AppCode/Demo.LicenseTrack.Data.Sql/Demo.LicenseTrack.Data.Sql.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88

99
<ItemGroup>
1010
<PackageReference Include="CodeFactory.NDF" Version="1.23111.1" />
11+
<PackageReference Include="CodeFactory.NDF.SQL" Version="1.22326.1" />
1112
<PackageReference Include="Dapper" Version="2.1.21" />
1213
<PackageReference Include="System.Collections.Immutable" Version="8.0.0-rc.2.23479.6" />
1314
</ItemGroup>
1415

1516
<ItemGroup>
1617
<ProjectReference Include="..\Demo.LicenseTrack.App.Model\Demo.LicenseTrack.App.Model.csproj" />
18+
<ProjectReference Include="..\Demo.LicenseTrack.Data.Contracts\Demo.LicenseTrack.Data.Contracts.csproj" />
1719
<ProjectReference Include="..\Demo.LicenseTrack.Data.Sql.Model\Demo.LicenseTrack.Data.Sql.Model.csproj" />
1820
</ItemGroup>
1921

Demos/LicenseTrack/AppCode/Demo.LicenseTrack.Data.Sql/LibraryLoader.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using CodeFactory.NDF;
2+
using Demo.LicenseTrack.Data.Sql.Model;
23
using Microsoft.Extensions.Configuration;
34
using Microsoft.Extensions.DependencyInjection;
45
using System;
@@ -34,11 +35,15 @@ protected override void LoadManualRegistration(IServiceCollection serviceCollect
3435
}
3536

3637

38+
39+
40+
41+
3742
/// <summary>
38-
/// Loads transient service registrations with the hosting DI container.
43+
/// Automated registration of classes using transient registration.
3944
/// </summary>
40-
/// <param name="serviceCollection">The dependency injection provider to register services with.</param>
41-
/// <param name="configuration">The source configuration to provide for dependency injection.</param>
45+
/// <param name="serviceCollection">The service collection to register services.</param>
46+
/// <param name="configuration">The configuration data used with register of services.</param>
4247
protected override void LoadRegistration(IServiceCollection serviceCollection, IConfiguration configuration)
4348
{
4449
//Intentionally blank

0 commit comments

Comments
 (0)