|
|
@ -50,7 +50,8 @@ public unsafe readonly partial struct Entity<TContext> |
|
|
|
public Entity<TContext> CreateLookup<T>() |
|
|
|
public Entity<TContext> CreateLookup<T>() |
|
|
|
{ |
|
|
|
{ |
|
|
|
ref var lookup = ref Lookup<TContext>.Entity<T>.Value; |
|
|
|
ref var lookup = ref Lookup<TContext>.Entity<T>.Value; |
|
|
|
if (lookup.IsSome) throw new InvalidOperationException( |
|
|
|
if (lookup == this) { /* Don't throw if lookup already has the same entity set. */ } |
|
|
|
|
|
|
|
else if (lookup.IsSome) throw new InvalidOperationException( |
|
|
|
$"The lookup for type {typeof(T)} in context {typeof(TContext)} is already in use by {lookup}"); |
|
|
|
$"The lookup for type {typeof(T)} in context {typeof(TContext)} is already in use by {lookup}"); |
|
|
|
lookup = this; |
|
|
|
lookup = this; |
|
|
|
return this; |
|
|
|
return this; |
|
|
|