Refactor EnsureEntity<T> for clarity and consistency
Renamed local variable from 'cluster' to 'entities' in EnsureEntity<T> and unified logic for selecting entity options. Improved readability by consistently using entities.TryGetValue and clearer variable naming.
This commit is contained in:
@@ -12,11 +12,11 @@ public record DbModelOptions
|
||||
public void EnsureEntity<T>(bool isVirtual)
|
||||
{
|
||||
|
||||
var cluster = isVirtual
|
||||
var entities = isVirtual
|
||||
? VirtualEntities.ToDictionary(kvp => kvp.Key, kvp => kvp.Value as EntityBaseOptions)
|
||||
: Entities.ToDictionary(kvp => kvp.Key, kvp => kvp.Value as EntityBaseOptions);
|
||||
|
||||
if(cluster.TryGetValue(nameof(T), out var entityOptions))
|
||||
if(entities.TryGetValue(nameof(T), out var entityOptions))
|
||||
entityOptions.EnsureProperties<T>();
|
||||
else
|
||||
throw new DbModelConfigurationException($"Entity options for type '{typeof(T).FullName}' not found.");
|
||||
|
||||
Reference in New Issue
Block a user