Skip to content

Provide a way for proxy to tell that initialization is not required for certain properties #2250

Open
@bahusoid

Description

@bahusoid

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions