-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Credits added to story model - Credits handled in create, edit, and display portion - Everything works but still needs proper styling, see the aforementioned issue
- Loading branch information
Showing
15 changed files
with
2,834 additions
and
128 deletions.
There are no files selected for viewing
276 changes: 158 additions & 118 deletions
276
Ogma3/CompiledModels/ApplicationDbContextModelBuilder.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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,178 @@ | ||
// <auto-generated /> | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.ChangeTracking; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Storage; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; | ||
using Ogma3.Data.Stories; | ||
|
||
#pragma warning disable 219, 612, 618 | ||
#nullable disable | ||
|
||
namespace CompiledModels | ||
{ | ||
internal partial class CreditEntityType | ||
{ | ||
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) | ||
{ | ||
var runtimeEntityType = model.AddEntityType( | ||
"Ogma3.Data.Stories.Credit", | ||
typeof(Credit), | ||
baseEntityType); | ||
|
||
var storyId = runtimeEntityType.AddProperty( | ||
"StoryId", | ||
typeof(long), | ||
afterSaveBehavior: PropertySaveBehavior.Throw, | ||
sentinel: 0L); | ||
storyId.TypeMapping = LongTypeMapping.Default.Clone( | ||
comparer: new ValueComparer<long>( | ||
(long v1, long v2) => v1 == v2, | ||
(long v) => v.GetHashCode(), | ||
(long v) => v), | ||
keyComparer: new ValueComparer<long>( | ||
(long v1, long v2) => v1 == v2, | ||
(long v) => v.GetHashCode(), | ||
(long v) => v), | ||
providerValueComparer: new ValueComparer<long>( | ||
(long v1, long v2) => v1 == v2, | ||
(long v) => v.GetHashCode(), | ||
(long v) => v)); | ||
storyId.AddAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.None); | ||
|
||
var id = runtimeEntityType.AddProperty( | ||
"Id", | ||
typeof(int), | ||
valueGenerated: ValueGenerated.OnAdd, | ||
afterSaveBehavior: PropertySaveBehavior.Throw, | ||
sentinel: 0); | ||
id.TypeMapping = IntTypeMapping.Default.Clone( | ||
comparer: new ValueComparer<int>( | ||
(int v1, int v2) => v1 == v2, | ||
(int v) => v, | ||
(int v) => v), | ||
keyComparer: new ValueComparer<int>( | ||
(int v1, int v2) => v1 == v2, | ||
(int v) => v, | ||
(int v) => v), | ||
providerValueComparer: new ValueComparer<int>( | ||
(int v1, int v2) => v1 == v2, | ||
(int v) => v, | ||
(int v) => v), | ||
mappingInfo: new RelationalTypeMappingInfo( | ||
storeTypeName: "integer")); | ||
id.AddAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||
|
||
var link = runtimeEntityType.AddProperty( | ||
"Link", | ||
typeof(string), | ||
propertyInfo: typeof(Credit).GetProperty("Link", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(Credit).GetField("<Link>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
nullable: true); | ||
link.TypeMapping = StringTypeMapping.Default.Clone( | ||
comparer: new ValueComparer<string>( | ||
(string v1, string v2) => v1 == v2, | ||
(string v) => v.GetHashCode(), | ||
(string v) => v), | ||
keyComparer: new ValueComparer<string>( | ||
(string v1, string v2) => v1 == v2, | ||
(string v) => v.GetHashCode(), | ||
(string v) => v), | ||
providerValueComparer: new ValueComparer<string>( | ||
(string v1, string v2) => v1 == v2, | ||
(string v) => v.GetHashCode(), | ||
(string v) => v), | ||
mappingInfo: new RelationalTypeMappingInfo( | ||
dbType: System.Data.DbType.String)); | ||
link.AddAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.None); | ||
|
||
var name = runtimeEntityType.AddProperty( | ||
"Name", | ||
typeof(string), | ||
propertyInfo: typeof(Credit).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(Credit).GetField("<Name>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); | ||
name.TypeMapping = StringTypeMapping.Default.Clone( | ||
comparer: new ValueComparer<string>( | ||
(string v1, string v2) => v1 == v2, | ||
(string v) => v.GetHashCode(), | ||
(string v) => v), | ||
keyComparer: new ValueComparer<string>( | ||
(string v1, string v2) => v1 == v2, | ||
(string v) => v.GetHashCode(), | ||
(string v) => v), | ||
providerValueComparer: new ValueComparer<string>( | ||
(string v1, string v2) => v1 == v2, | ||
(string v) => v.GetHashCode(), | ||
(string v) => v), | ||
mappingInfo: new RelationalTypeMappingInfo( | ||
dbType: System.Data.DbType.String)); | ||
name.AddAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.None); | ||
|
||
var role = runtimeEntityType.AddProperty( | ||
"Role", | ||
typeof(string), | ||
propertyInfo: typeof(Credit).GetProperty("Role", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(Credit).GetField("<Role>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); | ||
role.TypeMapping = StringTypeMapping.Default.Clone( | ||
comparer: new ValueComparer<string>( | ||
(string v1, string v2) => v1 == v2, | ||
(string v) => v.GetHashCode(), | ||
(string v) => v), | ||
keyComparer: new ValueComparer<string>( | ||
(string v1, string v2) => v1 == v2, | ||
(string v) => v.GetHashCode(), | ||
(string v) => v), | ||
providerValueComparer: new ValueComparer<string>( | ||
(string v1, string v2) => v1 == v2, | ||
(string v) => v.GetHashCode(), | ||
(string v) => v), | ||
mappingInfo: new RelationalTypeMappingInfo( | ||
dbType: System.Data.DbType.String)); | ||
role.AddAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.None); | ||
|
||
var key = runtimeEntityType.AddKey( | ||
new[] { storyId, id }); | ||
runtimeEntityType.SetPrimaryKey(key); | ||
|
||
return runtimeEntityType; | ||
} | ||
|
||
public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) | ||
{ | ||
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("StoryId") }, | ||
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), | ||
principalEntityType, | ||
deleteBehavior: DeleteBehavior.Cascade, | ||
required: true, | ||
ownership: true); | ||
|
||
var credits = principalEntityType.AddNavigation("Credits", | ||
runtimeForeignKey, | ||
onDependent: false, | ||
typeof(ICollection<Credit>), | ||
propertyInfo: typeof(Story).GetProperty("Credits", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
fieldInfo: typeof(Story).GetField("<Credits>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), | ||
eagerLoaded: true); | ||
|
||
return runtimeForeignKey; | ||
} | ||
|
||
public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) | ||
{ | ||
runtimeEntityType.AddAnnotation("Relational:ContainerColumnName", "Credits"); | ||
runtimeEntityType.AddAnnotation("Relational:FunctionName", null); | ||
runtimeEntityType.AddAnnotation("Relational:Schema", null); | ||
runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); | ||
runtimeEntityType.AddAnnotation("Relational:TableName", "Stories"); | ||
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
Oops, something went wrong.