AFAIK this is not possible. You can't extend proxies, only override them. I think if you take a proxy definition from the WebSharper sources and include that in your project with your patches that should do the trick (I'm actually not sure in what order proxies are loaded so this might not work). That's not a very good solution but I don't think there's anything else you can do besides this and adding it directly in WebSharper.

By on 11/17/2015 1:06 AM ()

Thanks for the reply Istvan. If I had to make the proxies myself, what would be the steps to be able to proxy a function like the following:

1
String.StartsWith(String, StringComparison.Ordinal) 
By on 11/17/2015 7:16 AM ()

StartsWith without the comparision option is proxied, the sources are here.

By on 11/17/2015 2:05 PM ()

Thanks for the reply Adam. I am aware of all the proxied methods but I was hoping to find a solution to be able to proxy the methods used in the library that I am trying to compile.

By on 11/17/2015 3:51 PM ()

Like Istvan pointed out, you can't extend proxies unfortunately ATM. You have two choices:

  1. Copy the built-in proxies in your library and add your additional members to cover the target type more fully.

  2. Rewrite the library code to use a new type for the missing members and provide another proxy accordingly, or try to use a member that is available.

Either way, it would be great if you could send a PR for the missing proxies that you end up implementing.

BTW, the primary reason for disallowing proxy extensions is ambigious/duplicate proxied members. It is still an open question in WebSharper 4 how to deal with this and enable proxy extensions at the end (which as your case demonstrates is a valid and necessary feature.)

By on 11/17/2015 4:23 PM ()

Thanks for the explanation Adam. I'll send a PR if I make the implementations of the proxied methods I need.

By on 11/17/2015 4:39 PM ()
By on 11/19/2015 9:58 AM ()

Wow thanks a lot, just saw the commits of Loic!

By on 11/19/2015 11:55 AM ()

I wanted to add more information.

I am trying to compile a library which contains functionalities to be used from my backend and frontend. But it won’t compile because some of the type members call methods from the .net libraries which do not have proxies and I am not too sure how (or even whether it is possible) to create the proxy to make this methods available on the frontend.

These methods rely heavily on String.IsNullOrWhiteSpace and String.Format(String, Obj) but I can’t seem to be able to use it. Also I do use Regex.IsMatch and It does not seem possible to compile it as well.

And lastly all string comparaisons are done using ordinal sort rules but the following methods don’t seem to compile as well.

1
2
3
4
5
String.StartsWith(String, StringComparison.Ordinal) 

StringComparer.OrdinalIgnoreCase.Equals(Obj, Obj)

StringComparer.OrdinalIgnoreCase.GetHashCode(Obj)

How can I make those methods compile to be available on the frontend while keeping the existing implementation that my backend already use?

By on 11/13/2015 2:59 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper