NetTopologySuite / NetTopologySuite.Features

An implementation of Feature and FeatureCollection
BSD 3-Clause "New" or "Revised" License
8 stars 14 forks source link

Support separate "id" values on features. #11

Closed airbreather closed 4 years ago

airbreather commented 4 years ago

For context:

I don't think we need to go all the way to "IUniqueFeature", just "IUnique" should be enough.

Also, not all IUnique implementations will want the Id be settable, and we don't need it to be for any concrete plans that I know of right now, so just a getter for now. It's possible to add a setter later without breaking anyone:

public interface IEditableUnique : IUnique
{
    new object Id { set; }
}
FObermaier commented 4 years ago

:+1 for just IUnique.

Concerning IEditableUnique one could also argue that implementations of the interface shall only allow setting the ID once that is when no value has been assigned yet.

airbreather commented 4 years ago

only allow setting the ID once that is when no value has been assigned yet

Yeah that kind of thought is why I wanted to limit what we offer to just a read-only property, since some implementations may memberwise-copy an existing instance and replace its ID with a new one, which means that we probably don't want to 100% define any behavior in our own interface contract.