我可以使用Silverlight dll c ++和WCF吗? [英] Can I use Silverlight dll c++ and WCF

查看:88
本文介绍了我可以使用Silverlight dll c ++和WCF吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好



我被分配了一个项目,该项目使用生物识别设备来检测手部静脉。设备检测到手并允许您保存,验证,识别和删除用户信息



该项目基于C#WinForm,该项目使用了一个开发的dll c + + / CLI中的另一个项目。这个dll调用存储在计算机中的一系列dll文件(c)



问题是我的老板告诉我应该使用WCF进行silverlight 5应用程序从互联网资源管理器中可视化。

我想知道它是否可行,如果是这样的话应该如何开发应用程序



- 应该我使用silverlight的dll c + + / CLI?尝试使用DllImport,但我认为只能使用这些方法而不是实例化dll类

- 我应该使用WCF的dll c + + / CLI吗?我只知道一点,WCF用于将消息从一个设备传输到另一个设备,但是如果从WFC中的silverlight dll c + + / CLI调用我的工作?

- 可能使用silverlight像这样的pojecto需要从计算机上的浏览器文件访问?



我希望你能帮助我

谢谢。

Hello

I was assigned a project which uses a biometric device to detect the hand veins . The device detects the hand and allows you to save , verify , identify and delete user information

The project is based on C # WinForm , this project uses a dll developed in another project in c + + / CLI . And this dll calls a series of dll files ( c ) stored in the computer

The problem is that my bosses told me I should use WCF for silverlight 5 application that will visualize from internet explorer .
It is here when I wonder if it is possible and if so how it should develop the application

- Should I use the dll c + + / CLI from silverlight ? Try using DllImport but I think only work to use the methods and not to instantiate the dll classes
- Should I use the dll c + + / CLI from WCF ? I only know a little, WCF is used to transfer messages from one device to another , but I work if called from silverlight dll c + + / CLI which is in WCF ?
- Is possible use silverlight for pojecto like this which requires access from the browser files on the computer?

I hope you can help me
Thank you.

推荐答案

不幸的是,我对你的理解问题是不完整的。首先,我不能立即看到它与你之前关于程序集的间接引用的问题(这是不存在的机制)有什么关系。顺便说一句,你对项目的解释看起来非常有趣,而且可能具有挑战性。让我首先回答看起来很明显的内容。



是的,您可以使用Silverlight中的C ++ / CLI并且应该这样做是您的C ++ / CLI项目包含宝贵的资源对于Silverlight解决方案。您只需将其编译为适当的目标.NET版本。但是你不应该使用P / Invoke;它是可能的,但只是打败了目的。我会解释一下。有两个选项:管理C ++ / CLI项目中的所有代码,或者可以是托管+非托管的混合模式项目。在第一种情况下,您可以在CLI程序集中引用此DLL(或者不是Silverlight项目),或者动态加载程序集或通过Reflection使用。换句话说,您的C ++ / CLI项目将编译为常规.NET程序集,并且应该像任何其他.NET程序集一样使用。如果这是一个混合模式项目(因为您有一些开发为非托管的代码),您将获得一个DLL,一些PE文件,一个具有双重用途的可执行模块:作为常规本机(非托管)DLL或作为常规.NET部件。因此,P / Invoke是可能的。不要这样做!获取C ++ / CLI的真正独特优势!即使你有一些非托管代码,将它包装在一些托管(ref)类/结构中,使其成为 public ,并使用你需要调用的成员来实现它可作为托管(.NET)程序集的对象/成员访问。这是C ++ / CLI的独特功能,允许跳过繁琐的P / Invoke。



使用WCF中的DLL C ++ / CLI只是一个不易理解的表达式对我来说。 WCF是另一个库,是.NET FCL的一部分。你不能从你自己的装配中注入任何东西。它将始终使用.NET FCL。但是序列化机制( Data Contract ,您需要阅读它)将允许您使用表示您需要使用WCF通过网络传递的数据的类。因此,您可以并且建议使用WCF,但不能使用来自WCF的DLL C ++ / CLI。相反,它将使用CCL / CLI(或任何其他.NET语言)与FCL。要了解相关信息,请参阅:

http://msdn.microsoft.com/en-us/library/ms733127%28v=vs.110%29.aspx [ ^ ]。



关于最后一个问题:我不明白这是什么意思,来自浏览器文件?我不知道任何浏览器文件。也许,再次,您需要解释目的或期望的行为。 什么而不是如何。



这就是现在的全部。如果您提供相关反馈,我们可以讨论更多相关信息。



SA -
Unfortunately, my understanding of you problem is incomplete. First of all, I cannot immediately see how is it related to your previous question about indirect reference of the assembly (which is the non-existing mechanism). By the way, your explanation of your project looks very interesting and, probably, challenging. Let me first answer to what looks obvious to me.

Yes, you can use C++/CLI from Silverlight and should do this is your C++/CLI project contains valuable resources for the Silverlight solution. You only need to compile it to appropriate target .NET version. But no way you should use P/Invoke; it would be possible but just defeat the purpose. I'll explain. There are two options: all the code in your C++/CLI project is managed, or it can be the mixed-mode project, managed + unmanaged. In first case, you can just reference this DLL in your CLI assembly (Silverlight project or not), or load your assembly dynamically or use via Reflection. In other words, your C++/CLI project will compile into a regular .NET assembly and should be used as such, as any other .NET assembly. If this is a mixed-mode project (because you have some code developed as unmanaged), you would obtain a DLL, some PE file, an executable module with dual use: either as regular native (unmanaged) DLL or as a regular .NET assembly. So, P/Invoke could be possible. Don't do it! Take the real unique benefit of C++/CLI! Even if you have some unmanaged code, wrap it in some managed ("ref") class/structure, make it public, with the members you need to invoke, to make it accessible as object/members of managed (.NET) assembly. This is the unique feature of C++/CLI which allows to skip cumbersome P/Invoke.

"Use the DLL C++/CLI from WCF" is just not a comprehensible expression to me. WCF is another library, part of .NET FCL. You cannot "inject" anything into it from your own assembly. It will always use .NET FCL as is. But the mechanism of serialization (Data Contract, you will need to read about it), will allow you to use your classes representing data you need to pass through the network using WCF. So, you can and are advised to use WCF, but not "the DLL C++/CLI from WCF". Rather, it will be using C++/CLI (or any other .NET language) with FCL. To get an idea, please see:
http://msdn.microsoft.com/en-us/library/ms733127%28v=vs.110%29.aspx[^].

About last question: I don't understand what does it mean, "from browser files"? I don't know any "browser files". Perhaps, again, you need to explain the purpose or desired behavior. "What" instead of "how".

That's all for now. If you provide relevant feedback, we can discuss more of it.

SA—


这篇关于我可以使用Silverlight dll c ++和WCF吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆