如何使用 LinqPad 进行 CRM 2011 更新
我正在使用 linqpad 和 crm 2011、云版本和 C# 片段。简单的选择查询就像宣传的那样工作。尽管如此,要使 linqpad 真正发挥作用,我还需要让它进行更新和插入,但无法找到有效的示例代码或提供任何真实信息。我在网上看到的示例代码中出现的几种内容都丢失了。特别是,TestDataContext 似乎是一个或多个程序集的一部分,这些程序集在 Visual Studio 中随 linq-sql 项目一起加载,但在 linqpad 上却没有明显体现。 SubmitChanges 不存在,并且不清楚我必须做什么才能获得它或实例化一个新的 DataContext 对象并尝试使用其 SubmitChanges 方法。
任何有用的信息将不胜感激。
I am working with linqpad and crm 2011, cloud version, and C# snippets. Simple select queries work as advertised. Nonetheless for linqpad to be of any real use I need to get it to do updates and inserts as well and have not been able to find sample code which works or come up with any real information. Several kinds of things which show up in sample code I see around the net are missing. in particular, TestDataContext appears to be part of one or more assemblies which get loaded with linq-sql projects in Visual Studio, but is not in evidence on linqpad. SubmitChanges is not there, and it is not clear what I'd have to do to get at it or to instantiate a new DataContext object and try to use its submitchanges method.
Any usable information would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯,我不知道 CRM 2011 LINQ 实施。 LINQPad 对此有直接支持吗?
无论如何,您基本上可以在 LINQPad 中运行任何 C# 代码。以下是如何运行所需代码的分步指南:
现在,通过这些步骤,您可以使用 LINQPad 中的任何 API。这样您就可以执行循环并使用常规 API 来更新对象。
Well I don't know the CRM 2011 LINQ implementation. Does LINQPad have direct support for that?
Anyway, you basically can run any C# code in LINQPad. Here's a step-by-step guide how to run the needed code:
Now with that steps you can use any API in LINQPad. With that you can do loops and use the regular API to update objects.
以下是 Linqpad for CRM 对我有用的内容。
请记住,Linqpad 中隐含了上下文。
创建新实体并加载其数据,然后:
Here's what worked for me in Linqpad for CRM.
Remember that the context is implied in Linqpad.
Create your new entity and load its data, then: