我喜欢LINQPad!我正在尝试使用LINQPad中的WCF连接器连接到Tridion Core Services,以帮助我快速开发和学习Core.
目前,LINQPad报告了URI的404(未找到)错误,但是同样的URI在我的浏览器中有效.
其他人成功连接?
LINQPad的连接窗口

Fra*_*len 13
LINQPad现在是我通过其核心服务API与Tridion交互的首选工具.
如果您只是下载普通的LINQPad,它可以连接到WCF数据服务(通常称为OData源),SQL Server数据库和Azure数据服务市场.由于Tridion的核心服务不属于这些类型,因此无法与其建立持久连接.
但是,您仍然可以通过以下步骤使用LINQPad作为Visual Studio的轻量级替代方法:
LINQPad可以处理多种语言.它默认为"C#Expression",这意味着您只需在代码面板中指定一个"语句"即可.这在使用例如可用驱动程序的SQL数据库时效果很好,但不足以与Tridion的核心服务进行交互.首先,您需要在查询顶部的工具栏中将其从"C#Expression"语言切换为"C#Program"语言.
切换语言后,我通常从以下样板开始
void Main()
{
// System.Runtime.Serialization.dll
// System.ServiceModel.dll
// System.Net.dll
// Namespaces:
// System.Net
// System.ServiceModel
// Tridion.ContentManager.CoreService.Client
var binding = new NetTcpBinding { MaxReceivedMessageSize = 2147483647, ReaderQuotas = new XmlDictionaryReaderQuotas { MaxStringContentLength = 2147483647, MaxArrayLength = 2147483647 } };
var endpoint = new EndpointAddress("net.tcp://<hostname>:2660/CoreService/2011/netTcp");
var DEFAULT_READ_OPTIONS = new ReadOptions();
CoreServiceClient client = new CoreServiceClient(binding, endpoint);
client.ChannelFactory.Credentials.Windows.ClientCredential = new NetworkCredential("<username>", "<password>");
try {
// TODO: fill in the blanks
} finally {
if (client.State == CommunicationState.Faulted) client.Abort(); else client.Close();
}
}
Run Code Online (Sandbox Code Playgroud)
粘贴此代码后,打开"查询属性"窗口(F4)并添加System.Runtime.Serialization.dll,System.ServiceModel.dll然后System.Net.dll打开"其他参考"选项卡.确保您的计算机上有Tridion.ContentManager.CoreService.Client.dll的副本,并添加对它的引用.(您可以在服务器上的Tridion/bin/client中找到它)
单击"添加System.Net" System.ServiceModel和Tridion.ContentManager.CoreService.Client"其他命名空间导入"选项卡.
更改<hostname>,<username>和<password>值在代码和测试,如果连接成功.
在此之后,填写空白并开始使用Core Service API.
我建议始终保持核心服务API文档(以CHM格式)打开.随着那个开放,我发现即使没有自动完成,我也可以走得很远.如果您保存刚创建的查询,可以使用ctrl-shift-C轻松克隆它,并且已经填写了语言,DLL引用和命名空间的新查询.
现在可以在此处记录从LINQPad连接到Tridion的更简单方法:https://sdltridionworld.com/articles/sdltridion2011/using_linqpad_with_tridion.aspx
Nun*_*res 12
通过这个阅读:http://markistaylor.com/2010/09/09/linqpad-beyond-linq/看起来你可以通过添加对System.ServiceModel.dll和[Tridion_Home]\bin的引用来做到这一点.\client\Tridion.ContentManager.CoreService.Client.dll(在Query - > Query Properties下)到LINQPad.
| 归档时间: |
|
| 查看次数: |
1276 次 |
| 最近记录: |