|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Text; |
| 5 | +using System.Threading.Tasks; |
| 6 | +using NHibernate.Engine; |
| 7 | +using NHibernate.Intercept; |
| 8 | +using NHibernate.Tuple.Entity; |
| 9 | + |
| 10 | +namespace NHibernate.Bytecode |
| 11 | +{ |
| 12 | + /// <summary> |
| 13 | + /// Encapsulates bytecode enhancement information about a particular entity. |
| 14 | + /// |
| 15 | + /// Author: Steve Ebersole |
| 16 | + /// </summary> |
| 17 | + public interface IBytecodeEnhancementMetadata |
| 18 | + { |
| 19 | + /// <summary> |
| 20 | + /// The name of the entity to which this metadata applies. |
| 21 | + /// </summary> |
| 22 | + string EntityName { get; } |
| 23 | + |
| 24 | + /// <summary> |
| 25 | + /// Has the entity class been bytecode enhanced for lazy loading? |
| 26 | + /// </summary> |
| 27 | + bool EnhancedForLazyLoading { get; } |
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Has the information about all lazy properties |
| 31 | + /// </summary> |
| 32 | + LazyPropertiesMetadata LazyPropertiesMetadata { get; } |
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// Has the information about all properties mapped as lazy="no-proxy" |
| 36 | + /// </summary> |
| 37 | + UnwrapProxyPropertiesMetadata UnwrapProxyPropertiesMetadata { get; } |
| 38 | + |
| 39 | + /// <summary> |
| 40 | + /// Build and inject an interceptor instance into the enhanced entity. |
| 41 | + /// </summary> |
| 42 | + /// <param name="entity">The entity into which built interceptor should be injected.</param> |
| 43 | + /// <param name="lazyPropertiesAreUnfetched">Whether all lazy properties were unfetched or not.</param> |
| 44 | + /// <param name="session">The session to which the entity instance belongs.</param> |
| 45 | + /// <returns>The built and injected interceptor.</returns> |
| 46 | + // TODO: Remove lazyPropertiesAreUnfetched when interceptor will be injected on entity instantiation |
| 47 | + IFieldInterceptor InjectInterceptor(object entity, bool lazyPropertiesAreUnfetched, ISessionImplementor session); |
| 48 | + |
| 49 | + /// <summary> |
| 50 | + /// Extract the field interceptor instance from the enhanced entity. |
| 51 | + /// </summary> |
| 52 | + /// <param name="entity">The entity from which to extract the interceptor.</param> |
| 53 | + /// <returns>The extracted interceptor.</returns> |
| 54 | + IFieldInterceptor ExtractInterceptor(object entity); |
| 55 | + |
| 56 | + /// <summary> |
| 57 | + /// Retrieve the uninitialized lazy properties from the enhanced entity. |
| 58 | + /// </summary> |
| 59 | + /// <param name="entity">The entity from which to retrieve the uninitialized lazy properties.</param> |
| 60 | + /// <returns>The uninitialized property names.</returns> |
| 61 | + ISet<string> GetUninitializedLazyProperties(object entity); |
| 62 | + |
| 63 | + /// <summary> |
| 64 | + /// Retrieve the uninitialized lazy properties from the entity state. |
| 65 | + /// </summary> |
| 66 | + /// <param name="entityState">The entity state from which to retrieve the uninitialized lazy properties.</param> |
| 67 | + /// <returns>The uninitialized property names.</returns> |
| 68 | + ISet<string> GetUninitializedLazyProperties(object[] entityState); |
| 69 | + } |
| 70 | +} |
0 commit comments