We have a query that looks like this:
var pg = entity as EntPointGroup;
var query = p_manager.EntPointSet
.Where(p => p.p_pointGroup.p_pointGroupID == pg.p_pointGroupID)
.Where(p => !(p.p_geoX == 0 && p.p_geoY == 0))
.GroupBy(p => new {p.p_pointGroupID})
.Select(g => new
{
m_maxGeoX = g.Max(p => p.p_geoX),
m_minGeoX = g.Min(p => p.p_geoX),
m_maxGeoY = g.Max(p => p.p_geoY),
m_minGeoY = g.Min(p => p.p_geoY)
});
It queries for points under a point group. Then we want the min- and maxvalues for x and y from the coordinates of these points to determine a boundary that contains all these points.
The result of this query is an anonymous type and this works fine.
But if I begin moving the points and there by changing their coordinates in the entity model and run the query again – I get the same min max values as before.
This is because it fetches the data from the datasource every time and not from the entity model.
If we make a known type GeoXY and query like this:
var pg = entity as EntPointGroup;
var query = p_manager.EntPointSet
.Where(p => p.p_pointGroup.p_pointGroupID == pg.p_pointGroupID)
.Where(p => !(p.p_geoX == 0 && p.p_geoY == 0))
.GroupBy(p => new {p.p_pointGroupID})
.Select(g => new GeoXY
{
m_maxGeoX = g.Max(p => p.p_geoX),
m_minGeoX = g.Min(p => p.p_geoX),
m_maxGeoY = g.Max(p => p.p_geoY),
m_minGeoY = g.Min(p => p.p_geoY)
});
We get this error:
Caught exception: System.Exception: Unable to locate type: System.Linq.IQueryable`1[[C2Net.CommonClasses.GeoXY, C2NetDomainModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e. Check that the assembly holding this type is available in the bin/exe folder. Also check that both your assemblies and DevForce assemblies have the expected version number on both client and server. at IdeaBlade.Core.TypeWrapper.FindType() at IdeaBlade.Core.TypeWrapper.Restore() at IdeaBlade.Core.TypeWrapper.get_Type() at IdeaBlade.Linq.ExpressionBlock.set_TypeWrapper(.....
We have added GeoXY to the same class that all of our other known types are located.
Is it even possible to query like this on the entity model?