-
Notifications
You must be signed in to change notification settings - Fork 38
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
[ODS-6551] Support feature for optimized use of serialized aggregate data #1184
Conversation
41e95cf
to
5e8ad8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments to help with code review.
@@ -292,11 +292,6 @@ protected override void Load(ContainerBuilder builder) | |||
.As<IResourceValidator>() | |||
.SingleInstance(); | |||
|
|||
builder.RegisterType<NoEntityExtensionsFactory>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of this interface is now protected by feature checks -- no need for a placeholder component/registration.
@@ -47,6 +48,13 @@ public override void ApplyConfigurationSpecificRegistrations(ContainerBuilder bu | |||
.As<IEntityExtensionRegistrar>() | |||
.SingleInstance(); | |||
|
|||
// Set feature-specific static resolvers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than setting the statics for these components in OdsStartupBase, they are now done here in the feature-specific module.
.As<IEntityDeserializer>() | ||
.SingleInstance(); | ||
|
||
builder.RegisterType<PersonSurrogateIdMutator>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These components handle lookup of USIs and DescriptorIds on Person types and Descriptor entities (respectively). They use the resolver/cache facilities when the values are needed after subsequent deserialization after initial creation (where they are not available to be serialized into the AggregateData column until after the entity is already INSERTed).
@@ -197,6 +211,11 @@ protected override void Load(ContainerBuilder builder) | |||
.As<ISessionFactory>() | |||
.SingleInstance(); | |||
|
|||
builder.Register( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component is needed in new locations to enable deserialized entities to be reassociated with the current NHibernate session.
|
||
namespace EdFi.Ods.Common.Database; | ||
|
||
public static class ColumnNames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Providing a location for commonly used column names to avoid expansion of embedded string values throughout the code.
@@ -90,7 +92,10 @@ await _container.Resolve<IApplicationRunner>() | |||
{ | |||
var baseException = e.GetBaseException() ?? e; | |||
|
|||
_logger.Error(baseException.Message); | |||
// Save the last exception in a static property to make it available for subsequent inspection. | |||
LastException = e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure we make the exception available to the calling code when we complete the call (from unit tests).
@@ -206,23 +211,27 @@ namespace EdFi.Ods.Entities.NHibernate.BusAggregate.Sample | |||
/// <summary> | |||
/// Represents a read-only reference to the <see cref="Bus"/> entity. | |||
/// </summary> | |||
[MessagePackObject] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference Data is serialized so that we don't have to look up the Id/Discriminator values separately. Full support of links is coming with ODS-6557.
@@ -536,8 +553,10 @@ public BusRoute() | |||
// Primary Key | |||
// ------------------------------------------------------------- | |||
[DomainSignature] | |||
[Key(6)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aggregate root entities start their key values at 6
due to inherited properties that are already marked for serialization.
@@ -629,6 +660,7 @@ public virtual int? StaffClassificationDescriptorId | |||
private int? _staffClassificationDescriptorId; | |||
private string _staffClassificationDescriptor; | |||
|
|||
[IgnoreMember] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We serialize descriptor Ids, not the full URI. It's definitive and more compact.
@@ -673,6 +706,7 @@ public virtual int? StaffUSI | |||
private int? _staffUSI; | |||
private string _staffUniqueId; | |||
|
|||
[IgnoreMember] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We serialize USIs not UniqueIds. It's definitive and more compact.
# Conflicts: # Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.2.0/DataStandard_520_ApprovalTests.Verify.Standard_Std_5.2.0_Models_Entities_Entities.generated.approved.cs
…roblems with single process-based code generation of multiple standards. Attach test reports from CodeGen processing for better error reporting. Exceptions occurring during code generation are now exposed to tests via a static LastException property.
…h derived resources.
…olumns are renamed.
…e key is defined on the base type so that query based on AK values can be properly constructed. Updated approval tests.
… during GetByKey where item has been reloaded through deserialization and the serialized data doesn't include the CreateDate value.
… "role" name for obtaining the NHibernate persister.
…(even before they are assigned by NHibernate), Student/Descriptor surrogate key resolution, and other edge case scenarios (like correct support for implicit extensions).
…ed approval tests.
…sisted USIs to be cleared, causing authorization failures.
…iately, and failing to resolve deserialized USIs into UniqueIds correctly.
…erived types when collections are inherited from a base type.
…persisters for implicit extensions.
…g surrogate ids after deserialization when the entity doesn't have it serialized yet.
…rence re-associated.
…Hibernate in case of deserialization failure.
… to allow them to surface during Postman test execution.
…ing data created without the extensions.
…serializing data created without the extensions.
… behind Extensions feature.
…feature being disabled.
…timized around serialized data feature setting.
This reverts commit af78a16.
// Maps the CreatedByOwnershipTokenID column dynamically | ||
// Requires there be a property on the base entity already | ||
// nHibernate wraps property getter exception in PropertyAccessException if any | ||
// underlying mapped properties are set to access "none", due to an invoke exception being triggered. | ||
// generated = "always" to avoid nHibernate trying to set values for it | ||
// <property name="CreatedByOwnershipTokenID" column="ChangeVersion" type="long" not-null="true" generated="always" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: This comment doesn't reflect the reality, seems to have been copy/pasted.
See also: