I have a class library that reads and writes to a local SQL CE database using Entity Framework 4.2 code first. I want to access the class library from a Silverlight 4 OOB app.
What is the best way to do this?
Do I have to turn the class library into a COM object?
Would it be better to use Silverlight 5?
With both Silverlight 4 and Silverlight 5, if you're using OOB, you can use elevated privileges to get access to lots of things, and with Silverlight 5, that includes the whole file system and P/Invoke if needed.
For that to work, you'll have to sign your app with a code signing certificate.
Related
I'm very new to Asp.Net Web Apis(which Microsoft has made a part of MVC templates though we can use Web Api template independent of MVC)....Just a little background.
Coming back to my problem when my Web Service is called by a user then along the line of what my Web Service is serving comes a point where I have to deserialize a Json file to a generic C# collection and cache it in-memory and then the code inside one of the Controller actions(which is obviously a get method) checks for the in-memory cache and if it has that deserialized C# collection it gets it from there else its calls another method inside the controller which caches this generic collection in memory.
My question is ...is this possible to cache the stuff for a Web Api like what I described above...I'm quite familiar with Asp.Net page life cycle,caching and sessions etc. But not with Web Api....And my above explanation is just an abstract idea...not sure how to execute it, will it work? If yes then what namespaces would come in handy like System.Runtime.Caching or System.Web.Caching.
Your answers will be highly appreciated....
In the .NET Framework 3.5 and earlier versions, ASP.NET provided an in-memory cache implementation in the System.Web.Caching namespace. In previous versions of the .NET Framework, caching was available only in the System.Web namespace and therefore required a dependency on ASP.NET classes. In the .NET Framework 4, the System.Runtime.Caching namespace contains APIs that are designed for both Web and non-Web applications. ASP.NET Web API doesn't have dependency in System.Web.dll so I recommend you to using System.Runtime.Caching, you can put your caching logic anywhere even in separate .dll file and use it in your ASP.NET Web API project.
I have some troubles with using Portable Class Library. I develop both iOS and Android app and I want to create shared business layer using PCL. However, I use WCF class. Particularly the problem is when I use IExtendableObject, which isn’t exist in PCL. Is it possible to circumvent this problem?
Sorry, but what is exactly IExtendableObject ? Do you mean IExtensibleDataObject ?
Exposing a WCF service does not requires Xamarin. Use your favorite IDE to designa and develop it. You just have to use basicHttpBinding, because Xamarin can only consume a WCF web service using this kind of binding. Do not create a WCF service with a PCL !
PCL allows you to share code between all your mobile applications. In your case, this is at least the proxy code. To create a Xamarin compatible proxy you will use the Silverlight Service Model Proxy Generation Tool from Silverlight SDK 5 (SLsvcUtil.exe). Unfortunatelly, this type ExtensionDataObject isn't available in Silverlight.
I'm a bit surprised to see this requirement in Xamarin as it's used for Forward-Compatible Data Contracts.
Thank you for advise! It works, but we won't do it in our project. Insteed of it, we now use sharing code method: http://docs.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/
I wish to use a particular API from my ASP Classic code. The API comes in the form of a DLL with .h and lib file. I have managed to use the api from my own Windows C++ application. I now wish to do the same for ASP. There is also a .NET Wrapper for this API which I haven't examined yet.
Furthermore, we will at some stage in the future migrate to ASP .NET or Python Django.
How would you recommend I wrap this API?
Thanks,
Barry
The best way is to wrap the DLL API that you need to use as a COM object.
The original ASP model makes use of COM to interface with native code.
I'm working in a project like this : http://msmvps.com/blogs/theproblemsolver/archive/2009/12/23/rehosting-the-workflow-designer-in-wf4.aspx
Is it possible to upload this app in a sharepoint and executed it in sharepoint??
As far as I know SharePoint is still using the WF3 runtime and not the WF4 runtime. So no this won't work.
you will have to create a separate Webservice Application (with the WF) in .net 4 and then from SharePoint you call the webservice. From WF you can in turn integrate with Sharepoint through the Managed client object model.
Refer to this link for more information on the client model:
http://msdn.microsoft.com/en-us/library/ee857094.aspx
a question concerning the new concept of Trusted Applications in Silverlight 4:
I gather that trusted applications run outside the browser with elevated trust. Will it therefore be possible to call arbitrary functions in unmanaged DLLs (by means of DllImport) from a trusted application or is this feature still reserved to proper desktop applications?
Thank you very much in advance and kind regards,
Marc Frei
Unfortunately, Silverlight 4 does not allow calling unmanaged code via P/Invoke. You can only call native code using the COM via the AutomationFactory class. However, calling native code was added to Silverlight 5.