Microsoft CRM 2011 表单 Silverlight 控件的配置/设置

发布于 2024-11-26 20:55:37 字数 513 浏览 2 评论 0原文

需要有关寻找解决方案的最佳实践的想法。

我们正在考虑为 CRM 表单开发 Silverlight 控件,这些控件需要引用通用的数据配置文件。这是一个需要每隔一段时间定期维护的文件。我们不想将值硬编码到 Silverlight 控件中。

我的问题是...我们在哪里/什么/如何为 Silverlight 控件提供配置文件?

我尝试上传一个 JS Web 资源,该资源只是一个 JSON 数组,其中包含我尝试从 Silverlight 控件访问的设置。当我使用管理员帐户和域帐户对文件进行 Http 获取并解析它时,我得到的只是权限错误。如果我设法解决这些烦人的权限错误,有人可以确认这可以工作吗?

我的下一个想法是拥有一个充满设置的 CRM 实体,Silverlight 控件可以对其进行 ODATA 调用以获取其配置数据。但我并没有 100% 接受这个想法。

也许人们一直在使用另一种方式 - 如果是这样 - 我很想看看你在做什么。这确实会阻止我们实现我们所追求的丰富的 Silverlight 解决方案。

提前致谢

Need an idea on best practise in finding a solution.

We are looking at developing Silverlight controls for CRM forms that will need to reference a common configuration file for data. It is a file that will need to be maintained periodically every once in a while. We don't want to be hardcoding values into the Silverlight control.

My question is... Where/What/How do we provide a config file for a Silverlight control?

I tried uploading a JS web resource that simply was a JSON array full of settings that I tried to access from the Silverlight control. All I got were permission errors when I used both the admin account and my domain account to do a Http get of the file and parse it. Can someone confirm that this could work if I manage to work through these annoying permission errors?

My next thought was having a CRM entity full of settings that the Silverlight control could make ODATA calls to in order to get its config data. I'm not 100% sold on the idea though.

Perhaps there is another way people have been using - if so - I'd love to see what you are doing. This could really prevent us from coming to a Silverlight enriched solution that we are after.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小伙你站住 2024-12-03 20:55:37

我们通过两种方式来解决这个问题。

  1. 我们有一个配置实体,用于设置可能由客户管理员在客户站点上更改的设置。
  2. 对于其他不太可能更改的配置数据,我们安装 XML Web 资源。这种方法意味着我们可以存储大量数据,而无需创建和管理复杂的实体(或关系,如果需要)。如果设置为非托管/可自定义 Web 资源,则可以使用文本编辑器进行更改,但请记住这些更改不得破坏 XML 架构/语法。

可以使用 WebClient.DownloadStringAsync() 在 Silverlight 中检索此 xml Web 资源,如下所示。

private void GetXmlConfiguration(string resourceName)
{
    var webClient = new WebClient();
    webClient.DownloadStringCompleted += OnGetConfigurationXmlCompleted;
    webClient.DownloadStringAsync(new Uri("../Data/" + resourceName, UriKind.Relative));
}

private void OnGetConfigurationXmlCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    if (e.Error == null && !string.IsNullOrEmpty(e.Result))
    {
        //use xml string here
    }
}

We go about this in two ways.

  1. We have a configuration entity for settings that might be changed on a customer site by their administrator.
  2. For other configuration data that is unlikely to be changed, we install an XML web resource. This method means we can store a lot of data without having to create and manage complex entities (or relationships if required). If set as an unmanaged/customizable web resource, then the text editor can be used to make changes, although remember that these changes must not break the XML schema/syntax.

This xml web resource can be retrieved in Silverlight using WebClient.DownloadStringAsync() as shown below.

private void GetXmlConfiguration(string resourceName)
{
    var webClient = new WebClient();
    webClient.DownloadStringCompleted += OnGetConfigurationXmlCompleted;
    webClient.DownloadStringAsync(new Uri("../Data/" + resourceName, UriKind.Relative));
}

private void OnGetConfigurationXmlCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    if (e.Error == null && !string.IsNullOrEmpty(e.Result))
    {
        //use xml string here
    }
}
金橙橙 2024-12-03 20:55:37

我们经常使用配置实体方法,我认为它效果很好。

您也应该能够使用您的初始方法...我知道在一些地方我们已经在 Web 资源中完成了一些 XML 配置,我们在 Silverlight 中检索、解析并使用了这些资源。

We use the configuration entity method quite often and I think it works well.

You should be able to use your initial method as well... I know in a few places we've done some XML configuration in a web resource that we've retrieved in Silverlight, parsed, and done something with.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文