Skip to content

Commit 61dc5d5

Browse files
committed
fix: remove unused code
1 parent e184e7f commit 61dc5d5

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

src/JsonApiDotNetCore/Data/DefaultEntityRepository.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -210,37 +210,6 @@ public void DetachRelationshipPointers(TEntity entity)
210210
}
211211
}
212212

213-
/// <summary>
214-
/// the constraint means it can be a to one or to many, but not hasmanythrough
215-
/// </summary>
216-
/// <returns><c>true</c>, if inverse was attached, <c>false</c> otherwise.</returns>
217-
/// <param name="entity">Entity.</param>
218-
/// <param name="relationship">Relationship.</param>
219-
/// <typeparam name="TRelationAttr">The 1st type parameter.</typeparam>
220-
public virtual TPrincipal AttachInverse<TPrincipal>(TEntity entity, RelationshipAttribute relationship) where TPrincipal : class, IIdentifiable<int>
221-
{
222-
if (relationship is HasManyThroughAttribute) return null;
223-
224-
var entityMeta = _context.Model.FindEntityType(typeof(TPrincipal));
225-
INavigation inverseNavigation = entityMeta.FindNavigation(relationship.InternalRelationshipName).FindInverse();
226-
227-
if (inverseNavigation != null)
228-
{
229-
//TODO: need to make sure we're not reattaching
230-
entity = (TEntity)((IEnumerable<object>)PreventReattachment(new List<TEntity> { entity })).Single();
231-
var entityEntry = _context.Attach(entity);
232-
entityEntry.Reload(); // TODO: we should only reload if the involved foreign key value is null.
233-
entityEntry.Reference(inverseNavigation.Name).Load();
234-
235-
return (TPrincipal)inverseNavigation.PropertyInfo.GetValue(entity);
236-
237-
}
238-
return null;
239-
240-
}
241-
242-
243-
244213
/// <summary>
245214
/// This is used to allow creation of HasMany relationships when the
246215
/// dependent side of the relationship already exists.

src/JsonApiDotNetCore/Data/IEntityReadRepository.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,5 @@ public interface IEntityReadRepository<TEntity, in TId>
8282
/// Convert the collection to a materialized list
8383
/// </summary>
8484
Task<IReadOnlyList<TEntity>> ToListAsync(IQueryable<TEntity> entities);
85-
TPrincipal AttachInverse<TPrincipal>(TEntity entity, RelationshipAttribute relationship) where TPrincipal : class, IIdentifiable<int>;
8685
}
8786
}

0 commit comments

Comments
 (0)