In answer to my own question, here's the answer - what I was missing was that you can require the incoming type to execute a specific interface and still have it available as the necessary type.
So here is what I came up with:
public void UpdateEntities<TEntity>(ICollection<TEntity> pocoCollection, ICollection<TEntity> dbCollection) where TEntity : class, IEntity {
The part I was looking for was where TEntity : class, IEntity
In this solution I have to make sure that my objects implement the IEntity interface, which is simple:
public interface IEntity { int Id { get; set;} DateTime ValidFrom { get; set; } DateTime? ValidTo { get; set; } }
This allows the compiler to stop complaining about the use of these properties, while I can still use the actual type, so the Entity Framework is also satisfied and left less confused as to what is happening.
Hope this helps someone else.
source share