Browse Source

Update the EF 6.x/EF Core entities to use HashSet instead of List and automatically register EF 6.x context classes in the DI container

pull/620/head
Kévin Chalet 8 years ago
parent
commit
b348a12a1c
  1. 4
      src/OpenIddict.EntityFramework.Models/OpenIddictApplication.cs
  2. 2
      src/OpenIddict.EntityFramework.Models/OpenIddictAuthorization.cs
  3. 3
      src/OpenIddict.EntityFramework/OpenIddictEntityFrameworkBuilder.cs
  4. 4
      src/OpenIddict.EntityFrameworkCore.Models/OpenIddictApplication.cs
  5. 2
      src/OpenIddict.EntityFrameworkCore.Models/OpenIddictAuthorization.cs

4
src/OpenIddict.EntityFramework.Models/OpenIddictApplication.cs

@ -29,7 +29,7 @@ namespace OpenIddict.EntityFramework.Models
/// <summary>
/// Gets the list of the authorizations associated with this application.
/// </summary>
public virtual IList<TAuthorization> Authorizations { get; } = new List<TAuthorization>();
public virtual ICollection<TAuthorization> Authorizations { get; } = new HashSet<TAuthorization>();
/// <summary>
/// Gets or sets the client identifier
@ -94,7 +94,7 @@ namespace OpenIddict.EntityFramework.Models
/// <summary>
/// Gets the list of the tokens associated with this application.
/// </summary>
public virtual IList<TToken> Tokens { get; } = new List<TToken>();
public virtual ICollection<TToken> Tokens { get; } = new HashSet<TToken>();
/// <summary>
/// Gets or sets the application type

2
src/OpenIddict.EntityFramework.Models/OpenIddictAuthorization.cs

@ -67,7 +67,7 @@ namespace OpenIddict.EntityFramework.Models
/// <summary>
/// Gets the list of tokens associated with the current authorization.
/// </summary>
public virtual IList<TToken> Tokens { get; } = new List<TToken>();
public virtual ICollection<TToken> Tokens { get; } = new HashSet<TToken>();
/// <summary>
/// Gets or sets the type of the current authorization.

3
src/OpenIddict.EntityFramework/OpenIddictEntityFrameworkBuilder.cs

@ -8,6 +8,7 @@ using System;
using System.ComponentModel;
using System.Data.Entity;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection.Extensions;
using OpenIddict.Core;
using OpenIddict.EntityFramework;
using OpenIddict.EntityFramework.Models;
@ -82,6 +83,8 @@ namespace Microsoft.Extensions.DependencyInjection
throw new ArgumentException("The specified type is invalid.", nameof(type));
}
Services.TryAddScoped(type);
return Configure(options => options.DbContextType = type);
}

4
src/OpenIddict.EntityFrameworkCore.Models/OpenIddictApplication.cs

@ -36,7 +36,7 @@ namespace OpenIddict.EntityFrameworkCore.Models
/// <summary>
/// Gets the list of the authorizations associated with this application.
/// </summary>
public virtual IList<TAuthorization> Authorizations { get; } = new List<TAuthorization>();
public virtual ICollection<TAuthorization> Authorizations { get; } = new HashSet<TAuthorization>();
/// <summary>
/// Gets or sets the client identifier
@ -101,7 +101,7 @@ namespace OpenIddict.EntityFrameworkCore.Models
/// <summary>
/// Gets the list of the tokens associated with this application.
/// </summary>
public virtual IList<TToken> Tokens { get; } = new List<TToken>();
public virtual ICollection<TToken> Tokens { get; } = new HashSet<TToken>();
/// <summary>
/// Gets or sets the application type

2
src/OpenIddict.EntityFrameworkCore.Models/OpenIddictAuthorization.cs

@ -74,7 +74,7 @@ namespace OpenIddict.EntityFrameworkCore.Models
/// <summary>
/// Gets the list of tokens associated with the current authorization.
/// </summary>
public virtual IList<TToken> Tokens { get; } = new List<TToken>();
public virtual ICollection<TToken> Tokens { get; } = new HashSet<TToken>();
/// <summary>
/// Gets or sets the type of the current authorization.

Loading…
Cancel
Save