I think I may have found a bit of a problem in the OpenAccess ORM, although this might be a fairly rare case. Firstly, some background. We have our database tables defined as normal, but for security reasons (which were defined well before I came to the company...) database access is always performed through so called "Row Level Security Views". These views restrict the returned results to only those accessible to a particular user.
So in our example case, we have a Users table, and a Responsibilities table, both are populated, with Responsibilities table containing a foreign key linking the two. A user can be "made passive" (read deleted without actually removing the data), with the effect that the RLSView will no longer return this user. If we do a search for all responsibilities, and then iterate through them and access the rlsvResponsibility.rlsvUser navigational property, it throws an NoSuchObjectException
. I understand that it does this because it -expects- the object to be there (its defined as a foreign key on the table itself), but no user object is returned because of the security restrictions. I would think the expected behaviour would be that it returns null
, rather than throwing an exception, no?
var responsibilities = context.rlsvResponsibilities.Where(p => p.Important == true)
foreach (var value in responsibilities.ToList())
// try to access value.rlsvUser property, NoSuchObject exception is thrown.
Telerik.OpenAccess.Exceptions.NoSuchObjectException: No row for Company.OurDatabase.DataAccess.RlsvUsers ('Common'.'rlsvUsers') GenericOID@ffffaa38 RlsvUsers UserID=545 NOTRES
at OpenAccessRuntime.DataObjects.PCStateMan.handleException(Exception x)
at OpenAccessRuntime.DataObjects.PCStateMan.getObjectFieldImp(PersistenceCapable pc, FieldMetaData fmd, Object currentValue)
at Company.OurDatabase.DataAccess.RlsvResponsibilities.OpenAccessEnhancedGet_rlsvUsers(RlsvResponsibilities owner)
The example is a greatly simplified version of the case that actually produced the error, but hopefully this is enough information to see whats going on.
SQL Server (v. 10.0.1600)
latest version of Telerik OpenAccess (I think 2013 Q3 SP1?)