Tests show a whopping 10x improvement for medium sized data, works with .Net 4.5+ (both client and server), can run side by side with other bindings for cross platform purposes
Add compression support via configuration on a per operation basis.
The configuration must have a default behaviour option with default to no compression, other than that operation by operation overrides must be given.
The compression must add a header in the message indicating the data is compressed, this must be read by the client and intrepreted, no configuration should be needed in client side for this.
I am using your great Protobuf.WCF library and I have noticed an issue:
In ProtoBufModelGenerator.GetTargetAssemblies it loads all those potentially useless assemblies like NHibernate, Castle._, log4net, App_Web__ etc. What are you trying to accomplish here and is there any way to limit loaded types? (rather than adding them to the TypeExclusions array - this would be a bit cumbersome). A similar thing happens in TypeFinder.FindServiceContract. And it looks like you've got two separate exclusion lists. Afterwards some of the libraries cannot be loaded throwing lots of handled exceptions. A quick response will be appreciated.
Adding support for WebAPI 2.2, considering restful semantics.
So far:
responses will be in protobuf while request will continue to be in json, working on it.
content type is exchanged and negotiated via the accept and content-type headers.
for models which protobuf will not be able to support, json will be used, the protobuf client will need to be used for all communications, the library will be intrusive in the code. In case protoBuf cannot be used, secondary content types will be negotiated.
By default datacontractJsonSerializer is used for json to avoid json.net dependencies, "ProtoBufWebClient" can be inherited and certain methods can be overridden (documentation to come) to get custom json behaviour.
If the server proxy changes dramatically, the meta data might get outdated causing a mismatch eventually leading the serialization to fail. This will then cause all operations on the client side to start failing, serialization failures on client side must be detected and a fresh meta data request be made, optionally a decision might be taken while solving to let that operation fail and simply clear the meta data cache so that future operations will automatically request the meta data and hence succeed.
I tried making it work with a self hosted WCF, but I'm unsuccessful with the conversion of all the needed configuration to code for my ServiceHost element.
Can you please add an explanation on how to make it work with a self hosted wcf service?
Serialization from different types of collections is flawed, e.g. From list to array and viceversa does not work, this works with datacontract serializers.
If the ServiceContract exposes an method (with the OperationContract attribute on it), the following exception is thrown:
System.InvalidOperationException: The type System.DateTime does not have a data contract attribute and is not a primitive type.
at ProtoBuf.Services.Infrastructure.TypeFinder.d__2.MoveNext()
at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection)
at ProtoBuf.Services.Infrastructure.TypeFinder.<>c__DisplayClassa.b__8(Type contractType, String operationName)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at ProtoBuf.Services.Wcf.Bindings.ProtoBufBindingEndpointBehaviour.ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
at System.ServiceModel.ServiceHostBase.InitializeRuntime()
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
The project name "Protobug.Wcf.Sample" was accidentally left in the code instead of the actual namespace of the target object. This causes problems in case namespace is not defined in the data contracts to be serialized.