Does Naked Objects require that ICollection<T> properties on entities have setters?

Apr 12, 2013 at 2:02 PM
Does Naked Objects require that ICollection<T> properties on entities have setters?

MS Code Analysis recommends that they shouldn't have setters, but when I remove the setter from the template file, I get the below during runtime.
NakedObjects.Reflector.DotNet.Reflect.Util.InvokeException: System.Data.Entity.DynamicProxies.Vehicle_D26E4E5D52A59FF530D08DF19751A28ABB3561880074FE927D51E637535032BA is not a IEntityWithChangeTracker (all properties must be made virtual/Overrideable and all collection properties should be of type ICollection<T>) ---> NakedObjects.Core.Util.NakedObjectAssertException: System.Data.Entity.DynamicProxies.Vehicle_D26E4E5D52A59FF530D08DF19751A28ABB3561880074FE927D51E637535032BA is not a IEntityWithChangeTracker (all properties must be made virtual/Overrideable and all collection properties should be of type ICollection<T>)
Result StackTrace:
at NakedObjects.Core.Util.Assert.AssertTrue(String message, Object target, Boolean flag)
at NakedObjects.Core.Util.Assert.AssertTrue(String message, Boolean flag)
at NakedObjects.EntityObjectStore.EntityObjectStore.CheckProxies(Object objectToCheck)
at NakedObjects.EntityObjectStore.EntityObjectStore.LoadObject(Object domainObject, LocalContext context)
at NakedObjects.EntityObjectStore.EntityObjectStore.<>c__DisplayClass1a.<ResetContext>b__19(Object obj, CollectionChangeEventArgs args)
at System.Data.Objects.ObjectStateManager.OnObjectStateManagerChanged(CollectionChangeAction action, Object entity)
at System.Data.Objects.ObjectStateManager.AddEntry(IEntityWrapper wrappedObject, EntityKey passedKey, EntitySet entitySet, String argumentName, Boolean isAdded)
at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator
1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper1.SimpleEnumerator.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable
1 source)
at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1[TResult](IEnumerable1 sequence)
at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable
1 query, Expression queryRoot)
at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable1 source, Expression1 predicate)
Coordinator
Apr 12, 2013 at 2:10 PM
My recollection is that it is EF that requires the collection properties to have a setter - but I might be wrong on that.