Skip to content

Commit

Permalink
renamed PrimaryKeyHandlerRegistry property to PrimaryKeyHandlers, for…
Browse files Browse the repository at this point in the history
… consistency with the other property names
  • Loading branch information
slewis74 committed Jun 14, 2021
1 parent 457a2c4 commit e8f71a4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected FixtureWithRelationalStore()
config.TypeHandlers.Register(new ReferenceCollectionTypeHandler());
config.TypeHandlers.Register(new StringTinyTypeIdTypeHandler<CustomerId>());

config.PrimaryKeyHandlerRegistry.Register(new StringTinyTypeIdKeyHandler<CustomerId>());
config.PrimaryKeyHandlers.Register(new StringTinyTypeIdKeyHandler<CustomerId>());

config.InstanceTypeResolvers.Register(new ProductTypeResolver());
config.InstanceTypeResolvers.Register(new BrandTypeResolver());
Expand Down
4 changes: 2 additions & 2 deletions source/Nevermore/Advanced/WriteTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public TKey AllocateId<TKey>(Type documentType)

TKey AllocateIdForMapping<TKey>(DocumentMap mapping)
{
var handler = configuration.PrimaryKeyHandlerRegistry.Resolve(mapping);
var handler = configuration.PrimaryKeyHandlers.Resolve(mapping);
if (handler == null || !(handler is IPrimitivePrimaryKeyHandler primitivePrimaryKeyHandler))
throw new InvalidOperationException($"Primary key handler could not be resolved for type {mapping.Type}, or it is configured to use an identity key handler.");

Expand All @@ -234,7 +234,7 @@ TKey AllocateIdForMapping<TKey>(DocumentMap mapping)

object AllocateId(DocumentMap mapping)
{
var handler = configuration.PrimaryKeyHandlerRegistry.Resolve(mapping);
var handler = configuration.PrimaryKeyHandlers.Resolve(mapping);
if (handler == null || !(handler is IPrimitivePrimaryKeyHandler primitivePrimaryKeyHandler))
throw new InvalidOperationException($"Primary key handler could not be resolved for type {mapping.Type}, or it is configured to use an identity key handler.");

Expand Down
2 changes: 1 addition & 1 deletion source/Nevermore/IRelationalStoreConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface IRelationalStoreConfiguration
IReaderStrategyRegistry ReaderStrategies { get; }
ITypeHandlerRegistry TypeHandlers { get; }
IInstanceTypeRegistry InstanceTypeResolvers { get; }
IPrimaryKeyHandlerRegistry PrimaryKeyHandlerRegistry { get; }
IPrimaryKeyHandlerRegistry PrimaryKeyHandlers { get; }
IRelatedDocumentStore RelatedDocumentStore { get; set; }
IQueryLogger QueryLogger { get; set; }

Expand Down
12 changes: 6 additions & 6 deletions source/Nevermore/RelationalStoreConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public RelationalStoreConfiguration(Func<string> connectionStringFunc)

TypeHandlers = new TypeHandlerRegistry();

PrimaryKeyHandlerRegistry = new PrimaryKeyHandlerRegistry();
PrimaryKeyHandlerRegistry.Register(new StringPrimaryKeyHandler());
PrimaryKeyHandlerRegistry.Register(new IntPrimaryKeyHandler());
PrimaryKeyHandlerRegistry.Register(new LongPrimaryKeyHandler());
PrimaryKeyHandlerRegistry.Register(new GuidPrimaryKeyHandler());
PrimaryKeyHandlers = new PrimaryKeyHandlerRegistry();
PrimaryKeyHandlers.Register(new StringPrimaryKeyHandler());
PrimaryKeyHandlers.Register(new IntPrimaryKeyHandler());
PrimaryKeyHandlers.Register(new LongPrimaryKeyHandler());
PrimaryKeyHandlers.Register(new GuidPrimaryKeyHandler());

AllowSynchronousOperations = true;

Expand Down Expand Up @@ -87,7 +87,7 @@ public RelationalStoreConfiguration(Func<string> connectionStringFunc)
public ITypeHandlerRegistry TypeHandlers { get; }
public IInstanceTypeRegistry InstanceTypeResolvers { get; }

public IPrimaryKeyHandlerRegistry PrimaryKeyHandlerRegistry { get; }
public IPrimaryKeyHandlerRegistry PrimaryKeyHandlers { get; }

/// <summary>
/// MARS: https://docs.microsoft.com/en-us/sql/relational-databases/native-client/features/using-multiple-active-result-sets-mars?view=sql-server-ver15
Expand Down
2 changes: 1 addition & 1 deletion source/Nevermore/Util/DataModificationQueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ CommandParameterValues GetDocumentParameters(Func<DocumentMap, object> allocateI
var result = new CommandParameterValues();

//we never want to allocate id's if the Id column is an Identity
var keyHandler = configuration.PrimaryKeyHandlerRegistry.Resolve(mapping);
var keyHandler = configuration.PrimaryKeyHandlers.Resolve(mapping);
if (keyHandler is IPrimitivePrimaryKeyHandler primitiveKeyHandler)
{
// check whether the object's Id has already been provided, if not then we'll either use the one from the InsertOptions or we'll generate one
Expand Down

0 comments on commit e8f71a4

Please sign in to comment.