-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
235 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...c/Client/Boilerplate.Client.Core/Data/CompiledModel/OfflineDbContextAssemblyAttributes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// <auto-generated /> | ||
using Boilerplate.Client.Core.Data; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
|
||
#pragma warning disable 219, 612, 618 | ||
#nullable disable | ||
|
||
[assembly: DbContextModel(typeof(OfflineDbContext), typeof(OfflineDbContextModel))] |
47 changes: 47 additions & 0 deletions
47
...oilerplate/src/Client/Boilerplate.Client.Core/Data/CompiledModel/OfflineDbContextModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// <auto-generated /> | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
|
||
#pragma warning disable 219, 612, 618 | ||
#nullable disable | ||
|
||
namespace Boilerplate.Client.Core.Data | ||
{ | ||
[DbContext(typeof(OfflineDbContext))] | ||
public partial class OfflineDbContextModel : RuntimeModel | ||
{ | ||
private static readonly bool _useOldBehavior31751 = | ||
System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; | ||
|
||
static OfflineDbContextModel() | ||
{ | ||
var model = new OfflineDbContextModel(); | ||
|
||
if (_useOldBehavior31751) | ||
{ | ||
model.Initialize(); | ||
} | ||
else | ||
{ | ||
var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); | ||
thread.Start(); | ||
thread.Join(); | ||
|
||
void RunInitialization() | ||
{ | ||
model.Initialize(); | ||
} | ||
} | ||
|
||
model.Customize(); | ||
_instance = (OfflineDbContextModel)model.FinalizeModel(); | ||
} | ||
|
||
private static OfflineDbContextModel _instance; | ||
public static IModel Instance => _instance; | ||
|
||
partial void Initialize(); | ||
|
||
partial void Customize(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...ate/src/Client/Boilerplate.Client.Core/Data/CompiledModel/OfflineDbContextModelBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// <auto-generated /> | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
|
||
#pragma warning disable 219, 612, 618 | ||
#nullable disable | ||
|
||
namespace Boilerplate.Client.Core.Data | ||
{ | ||
public partial class OfflineDbContextModel | ||
{ | ||
private OfflineDbContextModel() | ||
: base(skipDetectChanges: false, modelId: new Guid("b97b95bd-89b9-4be0-a574-d2035391c0c8"), entityTypeCount: 1) | ||
{ | ||
} | ||
|
||
partial void Initialize() | ||
{ | ||
var userDto = UserDtoEntityType.Create(this); | ||
|
||
UserDtoEntityType.CreateAnnotations(userDto); | ||
|
||
AddAnnotation("ProductVersion", "9.0.0"); | ||
} | ||
} | ||
} |
111 changes: 111 additions & 0 deletions
111
...it.Boilerplate/src/Client/Boilerplate.Client.Core/Data/CompiledModel/UserDtoEntityType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// <auto-generated /> | ||
using System; | ||
using System.Reflection; | ||
using Boilerplate.Shared.Dtos.Identity; | ||
using Boilerplate.Shared.Enums; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | ||
|
||
#pragma warning disable 219, 612, 618 | ||
#nullable disable | ||
|
||
namespace Boilerplate.Client.Core.Data | ||
{ | ||
[EntityFrameworkInternal] | ||
public partial class UserDtoEntityType | ||
{ | ||
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) | ||
{ | ||
var runtimeEntityType = model.AddEntityType( | ||
"Boilerplate.Shared.Dtos.Identity.UserDto", | ||
typeof(UserDto), | ||
baseEntityType, | ||
propertyCount: 9, | ||
keyCount: 1); | ||
|
||
var id = runtimeEntityType.AddProperty( | ||
"Id", | ||
typeof(Guid), | ||
propertyInfo: typeof(UserDto).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(UserDto).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
valueGenerated: ValueGenerated.OnAdd, | ||
afterSaveBehavior: PropertySaveBehavior.Throw, | ||
sentinel: new Guid("00000000-0000-0000-0000-000000000000")); | ||
|
||
var birthDate = runtimeEntityType.AddProperty( | ||
"BirthDate", | ||
typeof(DateTimeOffset?), | ||
propertyInfo: typeof(UserDto).GetProperty("BirthDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(UserDto).GetField("<BirthDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
nullable: true, | ||
valueConverter: new DateTimeOffsetToBinaryConverter()); | ||
|
||
var email = runtimeEntityType.AddProperty( | ||
"Email", | ||
typeof(string), | ||
propertyInfo: typeof(UserDto).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(UserDto).GetField("<Email>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
nullable: true); | ||
|
||
var fullName = runtimeEntityType.AddProperty( | ||
"FullName", | ||
typeof(string), | ||
propertyInfo: typeof(UserDto).GetProperty("FullName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(UserDto).GetField("<FullName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); | ||
|
||
var gender = runtimeEntityType.AddProperty( | ||
"Gender", | ||
typeof(Gender?), | ||
propertyInfo: typeof(UserDto).GetProperty("Gender", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(UserDto).GetField("<Gender>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
nullable: true); | ||
|
||
var password = runtimeEntityType.AddProperty( | ||
"Password", | ||
typeof(string), | ||
propertyInfo: typeof(UserDto).GetProperty("Password", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(UserDto).GetField("<Password>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); | ||
|
||
var phoneNumber = runtimeEntityType.AddProperty( | ||
"PhoneNumber", | ||
typeof(string), | ||
propertyInfo: typeof(UserDto).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(UserDto).GetField("<PhoneNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
nullable: true); | ||
|
||
var profileImageName = runtimeEntityType.AddProperty( | ||
"ProfileImageName", | ||
typeof(string), | ||
propertyInfo: typeof(UserDto).GetProperty("ProfileImageName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(UserDto).GetField("<ProfileImageName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
nullable: true); | ||
|
||
var userName = runtimeEntityType.AddProperty( | ||
"UserName", | ||
typeof(string), | ||
propertyInfo: typeof(UserDto).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(UserDto).GetField("<UserName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); | ||
|
||
var key = runtimeEntityType.AddKey( | ||
new[] { id }); | ||
runtimeEntityType.SetPrimaryKey(key); | ||
|
||
return runtimeEntityType; | ||
} | ||
|
||
public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) | ||
{ | ||
runtimeEntityType.AddAnnotation("Relational:FunctionName", null); | ||
runtimeEntityType.AddAnnotation("Relational:Schema", null); | ||
runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); | ||
runtimeEntityType.AddAnnotation("Relational:TableName", "Users"); | ||
runtimeEntityType.AddAnnotation("Relational:ViewName", null); | ||
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); | ||
|
||
Customize(runtimeEntityType); | ||
} | ||
|
||
static partial void Customize(RuntimeEntityType runtimeEntityType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.