Skip to content

Property-ref on many-to-one with composite id fails #1918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/NHibernate/Async/Type/ComponentType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,18 @@ public override Task<object> SemiResolveAsync(object value, ISessionImplementor
{
return Task.FromCanceled<object>(cancellationToken);
}
//note that this implementation is kinda broken
//for components with many-to-one associations
return ResolveIdentifierAsync(value, session, owner, cancellationToken);
try
{
//note that this implementation is kinda broken
//for components with many-to-one associations
if (ReturnedClass.IsInstanceOfType(value))
return Task.FromResult<object>(value);
return ResolveIdentifierAsync(value, session, owner, cancellationToken);
}
catch (Exception ex)
{
return Task.FromException<object>(ex);
}
}

public override async Task<bool> IsModifiedAsync(object old, object current, bool[] checkable, ISessionImplementor session, CancellationToken cancellationToken)
Expand Down
2 changes: 2 additions & 0 deletions src/NHibernate/Type/ComponentType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ public override object SemiResolve(object value, ISessionImplementor session, ob
{
//note that this implementation is kinda broken
//for components with many-to-one associations
if (ReturnedClass.IsInstanceOfType(value))
return value;
return ResolveIdentifier(value, session, owner);
}

Expand Down