How to use DreamFactory .Net SDK from Windows Phone 8.1 C#


#1

I am trying to consume the DreamFactory .Net SDK ( Target framework - .Net 4.5 ) from a Windows Phone 8.1 target project.

But it seems this are not compatible.

Details -

On creating an object for IRestContext ( in Windows Phone 8.1 project), it crashes on creating an object for DreamFactory.Serialization.JsonContentSerializer with error -

“Could not load type ‘System.Runtime.Serialization.Formatters.FormatterAssemblyStyle’ from assembly ‘mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e’.”
"

As I understand there seems to be a huge difference between Dot Net 4.5 and Windows Phone 8.1 judging from the fact of a similar compatibility issue between Dot Net 4.0 and Dot Net 4.5 at
http://stackoverflow.com/questions/13748055/could-not-load-type-system-runtime-compilerservices-extensionattribute-from-as

How to use DreamFactory .Net SDK in Windows Phone 8.1 ?


#2

The JSON Serialization issue was fixed by switching the JSON library reference from “Net45” to “portable-net45+wp80+win8+wpa81+aspnetcore50”.

However, next issue comes up at DreamFactory.Http.HttpUtils.CheckUrlString(…)
Error - “Could not load file or assembly”


#3

NuGet package was built against .Net 4.5.
In order to build it for Windows Phone, please get the SDK source code from GitHub and add the API project (csproj with source code) to your solution.
Because it has a dependency on UniRest, NuGet packages manager will use a proper version for this dependency and the API should be build with no issues.
Check for Windows Phone Class Library project type while creating the project for API.


#4

I tried to compile the DreamFactory SDK source as a Portable Class Library (i.e. Universal Apps, as am targeting both Windows 8.1 and Windows Phone 8.1), but unable to compile since the [Serializable] attribute (used in class DreamFactoryException) is not available in .NETPortable 4.6 nor in .NetCore 4.5 frameworks.

http://stackoverflow.com/questions/12903262/portable-class-library-recommended-replacement-for-serializable

It seems the DreamFactory .Net SDK might need conditional compilation for Windows 8.1 support.


#5

Hi Andrei,

Not sure if am missing something basic here, but would appreciate your thoughts on this topic.


#6

There is a good reading on this:
[cannot attach link as I am a new user here - see the suggested link to StackOverflow in above]
In order to fully support portable framework, one needs to modify the source code as suggested in the article.
The original .NET SDK package (and source code) was targeted desktop platforms.


#7

Yes , I understand that.
The relevant question is will .Net Windows Phone be supported on the DreamFactory Platform going forward as a standard platform ( with regular enhancements, bug fix etc ).


#8

DreamFactory is a REST API platform. Any client on any platform able to make HTTP calls and pass payloads in JSON/XML may integrate with it as a standard. The .NET SDK is simply an example of implementing some of the calls that can be made to a DreamFactory API from any client.

If you’re asking if DreamFactory will continue to be supported with regular enhancements and bug fixes, the answer is yes. If you’re asking about the current .NET SDK, which is for DreamFactory 1.9.x, the answer is no. (New SDKs will be developed for 2.0.) But by the time you’ve looked at the SDK, learned how it works, and written your own app, you should no longer be dependent on the SDK.