nhibernate-core
                                
                                 nhibernate-core copied to clipboard
                                
                                    nhibernate-core copied to clipboard
                            
                            
                            
                        Provide a way for proxy to tell that initialization is not required for certain properties
It would be really helpful for composite keys when key properties are also exposed in Entity for convenience. Something like:
public class CompositeId
{
	public int Key1 {get;set;}
	public int Key2 {get;set;}
}
public class Entity
{
	public virtual CompositeId Id { get; set; } = new CompositeId();
	// This property doesn't require entity initialization.
	// But there is no way to tell NHibernate that
	public virtual int Key1
	{
		get => Id.Key1;
		set => Id.Key1 = value;
	}
	public virtual int Key2
	{
		get => Id.Key2;
		set => Id.Key2 = value;
	}
}
Or when Id property is accessed via interface with different name (see #2184)
Are you thinking about adding a dedicated attribute in NHibernate which would be used as a marker for such properties?
Yes that's one possibility. Alternatively to keep NHibernate out of entity I'm thinking of some static class with user provided generator settings for type members (for now with single SkipInitialization flag). Configuration could look something like:
ProxySettings
	.Add<Entity>(settings => settings.SkipInitialization = true, x => x.Member1, x => x.Member2,... )
	.Add<Entity2>(...);
In case mapping by code it seems such configuration can be placed along with entity mapping.
Also I realized implementation shouldn't be restricted to properties - methods also should be supported.
Could it be inferred from generated attribute on the property mapping?
Are you about this mapping? https://nhibernate.info/doc/nh/en/index.html#mapping-generated
No I don't think it's related to this feature. Proxy initialization is required on property access of generated properties (if it's not ID property)
And this feature is useful for properties/methods that are safe to call for un-initialized proxy (so they only access identifier or some static or not persistent data).