DomainContext加载(DomainContext Load)
我尝试通过domainservice(async)在代码行中加载一个实体,如:
context.Load<Book>( context.Books.Where(b => b.BookID == 1), (s, e) => { _book = e.Results; }, null);
但我得到以下错误:类型'SilverlightApplication1.Book'不能在泛型类型或方法'System.ServiceModel.DomainServices.Client.DomainContext.Load(System.ServiceModel.DomainServices.Client.EntityQuery)中用作类型参数'TEntity'。 ,System.Action>,object)'。 没有从'SilverlightApplication1.Book'到'System.ServiceModel.DomainServices.Client.Entit的隐式引用转换
怎么解决?
I tried to load a entity by domainservice(async) in on line of code like:
context.Load<Book>( context.Books.Where(b => b.BookID == 1), (s, e) => { _book = e.Results; }, null);
But I got following error: The type 'SilverlightApplication1.Book' cannot be used as type parameter 'TEntity' in the generic type or method 'System.ServiceModel.DomainServices.Client.DomainContext.Load(System.ServiceModel.DomainServices.Client.EntityQuery, System.Action>, object)'. There is no implicit reference conversion from 'SilverlightApplication1.Book' to 'System.ServiceModel.DomainServices.Client.Entit
how to fix it?
原文:https://stackoverflow.com/questions/3644485
最满意答案
几件事:
- 休息并不意味着你的想法。 你应该使用return来保留这个功能
- 您可能想要在调用相邻单元格的函数之前检查您是否位于域的边界(否则,它将崩溃)
- 使用递归填充洪水是很好的...仅用于教育目的。 使用队列效率更高
- 一个简单的事情就是尝试一下,看它是否有效!
Several things:
- break does not mean what you think it does. You should use return to leave the function
- You may want to check whether you are at the boundary of your domain before calling the function for the adjacent cells (otherwise, it will crash)
- using a recursion for a flood fill is great... for educational purpose only. Using a queue is much more efficient
- a simple thing is to try it out and see whether it works !
相关问答
更多-
TCP/IP模型是一个________。[2023-05-19]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
洪水填充算法(Flood fill algorithm)[2021-07-10]
除了推动堆栈中的每个像素之外,尝试在推入堆栈中的新位置之前尽可能多地填充像素。 请参阅维基百科文章进行讨论。 Instead of pushing every pixel on the stack, try to fill as many pixels as possible horizontally before pushing a new position on the stack. See the Wikipedia article for a discussion. -
懒得试试你的代码,但在这里有些东西(有些已经在评论中提到过): 你在map[][]检查递归调用 是的,你有这样的: if (x < 0 || y < 0 || x > map.length || y > map[0].length ) return; 但这并不好(甚至是无用的),因为递归调用可以访问高达+2和-1索引越界。 也应该是>= map[0].length 。 我会删除,如果完全,而是使用: if (x> 0) floodFill(x-1,y, oldChar, newC ...
-
几件事: 休息并不意味着你的想法。 你应该使用return来保留这个功能 您可能想要在调用相邻单元格的函数之前检查您是否位于域的边界(否则,它将崩溃) 使用递归填充洪水是很好的...仅用于教育目的。 使用队列效率更高 一个简单的事情就是尝试一下,看它是否有效! Several things: break does not mean what you think it does. You should use return to leave the function You may want to check ...
-
StackOverflowException意味着,你的递归对你的内存来说太深或者不会结束。 试试更小的图像。 当这不能解决问题时,递归结束条件会出现问题。 (setPixel()和getPixel是否真的改变图像?写一个JUnitTest ) 你也应该简化你的setPixel和getPixel方法。 他们太复杂了。 对于您设置的每个像素,或者创建一个新的BufferedImage-Instance,然后在设置一个像素后进行处理。 您可以存储和重新使用BufferedImage。 StackOverflow ...
-
你那里有一个灰度图像。 您不能在灰度图像上使用绿色。 这就是它变成浅灰色的原因。 你需要: 事先将图像转换为RGB 确保在Java中读取/转换图像为RGB 最后一个选项更安全,因为它在将来的图像上不会失败。 这是我在网络上发现的一些代码,据说可以转换为灰度。 一个小的修改,你有你需要的东西,以确保你正在处理彩色图像: public static BufferedImage convertToGrayscale(BufferedImage source) { BufferedImageOp op ...
-
三维表面重建算法(3D surface Reconstruction algorithm)[2022-03-30]
您提到的“轮廓”的技术术语是“等值线”。 给定一组等值线,首先需要在3D中构建点云(只是3D空间中的点集合)。 你分两个阶段做到这一点。 首先以均匀的间隔对每个等值线进行采样,得到2D点,然后将点提高到适当的高度。 通过在任何地方跟踪它,可以很容易地以均匀的间隔对线进行采样。 您可以通过从最外面的线开始并逐行向内查找线来了解线的高度,删除跟踪的每条线并跟踪您跟踪的线数。 当然,您需要事先知道线之间的高度差是什么,最外线(或任何其他可用作参考的线)的高度是多少? 拥有3D点云后,您可以使用多种曲面重建算法中的 ... -
也许: >>> m = np.zeros((2,2,3)) >>> m[:] = [10,20,3] >>> m array([[[ 10., 20., 3.], [ 10., 20., 3.]], [[ 10., 20., 3.], [ 10., 20., 3.]]]) >>> m[0,0] array([ 10., 20., 3.]) >>> m[0,1] array([ 10., 20., 3.]) >>> m[1,0 ...
-
不应在SQL中实现快速泛洪填充。 您可以将所有需要的数据加载到适当的结构(可能是某些图形表示或3d数组,具体取决于数据的密度),并运行堆栈/队列或您可以用手头的编程语言编写的任何其他实现。 根据定义,泛洪填充是递归的(即使它通常由循环实现),并且SQL不擅长递归,也不擅长循环。 但是有一些东西可能会在mysql中使用,即使它不是一个普通的SQL解决方案。 有一个特殊的引擎来处理图形 - OQGRAPH 。 它可以在MariaDB中使用,可能可以安装到MySQL。 它支持组合图的有效存储,其中网格只是一种特殊 ...