Quantcast
Channel: WCF Data Services forum
Viewing all 877 articles
Browse latest View live

WCF Data Services Self-Hosted in a Console App and called from a thin client such as WPF or Silverlight

$
0
0

I've tried a walkthrough example that worked after some tweaking...

http://msdn.microsoft.com/en-us/library/dd465161.aspx

But the example is geared towards IIS-based WCF services. I've tried adapting the example so as to host the same WCF Data Service example in a "Self-Hosted" WCF service inside of a simple console application.

I'm constrained to get this to work on an XP machine that doesn't have IIS (Otherwise I would have used IIS or WAS (web product activation services). If I can get the console app with Self-Hosted WCF to work I might convert it later to a Windows Service.

I can get the basic mechanism to work but as soon as I try to get the Self-Hosted service to work with Entity Framework models it falls apart.

 

Does anyone have an example of how to port the example from the above URL to be inside of a Console-App and Self-Hosted WCF?

 

Here are some other URLs I used as reference:

http://msdn.microsoft.com/en-us/library/ms730158.aspx

 

Thanks in advance,

S

 

 


WCF Data Services Client 5.6: PostTunneling with Delete Issue

$
0
0

Hi,

I'm using the WCF Data Service Client 5.6 from NuGet to connect to my Odata service. I've enabled the UsePostTunneling property on the generated context (which inherits from System.Data.Services.Client.DataServiceContext), but when I try to perform a DELETE, I get a HTTP 411: "The request must be chunked or have a content length". PUT & PATCH requests to the service through post tunneling work fine.

It appears as though the Content-Length value is not being set in the headers for the request, but I don't see a way to change/verify this.

Can anyone confirm the Delete with PostTunneling turned on for the DataServiceContext?

Thanks,

David

How to use ASP.NET Dynamic Data and WCF Data Service together?

$
0
0
Can someone provide sample code for using ASP.NET Dynamic Data and WCF Data Service together?

Bug in WCF DS 5.6.0 - Actions on JSON format

$
0
0

Hi,

The scenario... I have a custom WCF Data Service provider with a dynamic model that can change runtime. I am working on a feature in our provider that will enable our partners and other development teams to supply additional OData Actions to be injected in the model at runtime. Until now they have only been able to inject new types and new properties on existing types. This works fine without any issues for any existing client that were compiled with a proxy missing these properties and types on both ATOM and JSON as long as DataServiceContext.IgnoreMissingProperties = true has been set.

For new Actions not available at compile time any client running JSON format with the default model generated by the DataSvcUtil/codegen will fail to deserialize/materialize du to the default model not knowing anything about the serialized Action. This is not a problem for ATOM, the "unknown" Action will even be included in the OperationDescriptor for the entity on the client.

This is the exception thrown from WCF DS on JSON format when the server sends an Action not part of the client model:

Test 'Scanjour.Services.OData.Test.Integration.PopularEntityTests.ValidateArgumentException' failed: Class Initialization method Scanjour.Services.OData.Test.Integration.PopularEntityTests.ClassInitialize threw exception. System.InvalidOperationException: System.InvalidOperationException: The metadata URI '#ODataService.Close' references the function import 'ODataService.Close'. However, no or multiple function imports with name 'ODataService.Close' are declared in the metadata. ---> Microsoft.Data.OData.ODataException: The metadata URI '#ODataService.Close' references the function import 'ODataService.Close'. However, no or multiple function imports with name 'ODataService.Close' are declared in the metadata..
	at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.CreateODataOperationAndAddToEntry(IODataJsonOperationsDeserializerContext readerContext, IODataJsonLightReaderEntryState entryState, String metadataReferencePropertyName)
	at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadSingleOperationValue(IODataJsonOperationsDeserializerContext readerContext, IODataJsonLightReaderEntryState entryState, String metadataReferencePropertyName, Boolean insideArray)
	at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadMetadataReferencePropertyValue(IODataJsonLightReaderEntryState entryState, String metadataReferencePropertyName)
	at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.<>c__DisplayClass2.<ReadEntryContent>b__0(PropertyParsingResult propertyParsingResult, String propertyName)
	at Microsoft.Data.OData.JsonLight.ODataJsonLightDeserializer.ProcessProperty(DuplicatePropertyNamesChecker duplicatePropertyNamesChecker, Func`2 readPropertyAnnotationValue, Action`2 handleProperty)
	at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadEntryContent(IODataJsonLightReaderEntryState entryState)
	at Microsoft.Data.OData.JsonLight.ODataJsonLightReader.ReadAtNavigationLinkEndImplementationSynchronously()
	at Microsoft.Data.OData.JsonLight.ODataJsonLightReader.ReadAtNavigationLinkEndImplementation()
	at Microsoft.Data.OData.ODataReaderCore.ReadImplementation()
	at Microsoft.Data.OData.ODataReaderCore.ReadSynchronously()
	at Microsoft.Data.OData.ODataReaderCore.InterceptException[T](Func`1 action)
	at Microsoft.Data.OData.ODataReaderCore.Read()
	at System.Data.Services.Client.Materialization.ODataReaderWrapper.Read()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.TryRead()
	 --- End of inner exception stack trace ---
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.TryRead()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.ReadEntryCore()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.TryReadEntry(MaterializerEntry& entry)
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.<LazyReadEntries>d__0.MoveNext()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.Read()
	at System.Data.Services.Client.Materialization.ODataReaderEntityMaterializer.ReadNextFeedOrEntry()
	at System.Data.Services.Client.Materialization.ODataEntityMaterializer.ReadImplementation()
	at System.Data.Services.Client.MaterializeAtom.MoveNextInternal()
	at System.Data.Services.Client.MaterializeAtom.MoveNext()
	at System.Linq.Enumerable.<CastIterator>d__b1`1.MoveNext()
	at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
	at System.Data.Services.Client.DataServiceQueryProvider.ReturnSingleton[TElement](Expression expression)
	at System.Data.Services.Client.DataServiceQueryProvider.Execute[TResult](Expression expression)
	at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
	PopularEntityTests.cs(40,0): at Scanjour.Services.OData.Test.Integration.PopularEntityTests.CreateTestData()
	PopularEntityTests.cs(25,0): at Scanjour.Services.OData.Test.Integration.PopularEntityTests.ClassInitialize(TestContext context)

Either we are missing something like DataServiceContext.IgnoreMissingActions or it should be implicit from setting DataServiceContext.IgnoreMissingProperties = true.

As a workaround you could load the model runtime using DataServiceContext.Format.LoadServiceModel, but I think it should work as described even on the codegen'ed model and as said it works out of the box on ATOM.

Regards

Uffe

VS2013 / EF6 — 'EntityFrameworkDataService' could not be found

$
0
0

I have followed the below two posts, and no luck:

POST 1 —
blogs . msdn . com/b/astoriateam/archive/2013/10/02/using-wcf-data-services-5-6-0-with-entity-framework-6.aspx

POST 2 —
nuget . org/packages/Microsoft.OData.EntityFrameworkProvider/


My solution cannot seem to locate the 'EntityFrameworkDataService' class at compile-time:

The type or namespace name 'EntityFrameworkDataService' could not be found (are you missing a using directive or an assembly reference?)	

If I revert back to inheriting from 'DataService' instead, I get following exception at run-time:

Expression of type 'System.Data.Entity.Core.Objects.ObjectContext' cannot be used for return type 'System.Data.Objects.ObjectContext'

I'm using Visual Studio 2013 and SQL Server 2012, and my project is referencing the following:

Microsoft.OData.EntityFrameworkProvider (1.0.0.0)
Microsoft.Data.Odata (5.6.0.0)
EntityFramework.dll (6.0.0.0)

Where is this elusive 'EntityFrameworkDataService' class? What is the full namespace?

How do I use Entity Framework 6 and WCF Data Services 5.6.0 with Visual Studio 2013 ?

Can´t install WCF Data Services 5.6(nuget) on a portable project after upgrading Xamarin

$
0
0

Hi

I'm having problems installing the WCF Data Services 5.6 on a portable project, in particular:

Could not install package 'System.Spatial 5.6.0'. You are trying to install this package into a project that targets 'portable-net45+sl40+wp80+win', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I'm targeting Net 4.5, Win 8 and Windows Phone8, what is weird is that the other dependency do install (Microsoft.Data.OData, Microsoft.Data.Edm and Microsoft.Data.Services.Client)

I used the package before installing Xamarin (lastest versión) and was working fine, but after the install I get the error above. Could be a configuration issue? a change in the profiles?

If I add the DLL´s by hand (Microsoft.Data.Edm.Portable, Microsoft.Data.OData.Portable, Microsoft.Data.Services.Client.Portable and System.Spatial.Portal), when I try to add the service reference I get this error:

"Unable to add a service reference to the specified OData feed because
WCF Data Services is not installed for this target framework. To install
a supported version of WCF Data Servicess"

There's a workaround? a manual installation?

Please forgive if I insist too much, I try to contact you via nuget and leave a comment on your blog because this is a huge issue (totally broke a project I'm working on for a client)

Thanks in advance

Roygar

WCF Data Services WebInvoke to Post Data

$
0
0

Ok, I thought this would be easy, but I am having a really hard time with this.

I have a WCF Data Services setup and it works perfectly on my Entity set for GETs, POSTs, PUTs and DELETEs.

  [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    public class MyWCFService : DataService<MyEntities>
    {
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.UseVerboseErrors = true;
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
            config.SetServiceActionAccessRule("*", ServiceActionRights.Invoke);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }

However, I have a particular case where I need to "POST" a complex type of entity with some custom business rules on the Insert. So, I tried to do a "WebInvoke"

   [WebInvoke(Method = "POST")]
        public User UpdateUser(string input)
        {

But the input string is always null. I assumed that would be the body of my request. So, I started to look around. Lots of suggestions, nothing seems to work. Here is some of the stuff I tried (or debunked):

1. WebGet - this won't work, my payload is too big for querystrings

2. HttpContext.Current.Request.InputStream and serialize to my object - this isn't working, it's always null

3. I've tried all combinations in the WebInvoke - BodyWrapper, RequestTypes, Method="*", etc... Nothing works

Anyways, I've been playing with this for hours and it just seems like the body of my message cannot be passed to a custom WebInvoke in WCF Data Services.

So, my conclusion is the WebInvoke is not the way to do this. If that is so, then I am lost on the correct methodology to POST the payload to a custom Method in WCF Data Services for one-off/complex types of situations.

Please help!!!!

BTW: I am using WCF Data Services 5.6

Thanks,

Greg

Access SSAS cube through WCF

$
0
0

I have cube connected with the normal asp.net web application and its working fine.

now i want access the cube through WCF service .When i tried it throughs the error

"Either the user, xxx, does not have access to the xxx database, or the database does not exist."

In IIS, i made windows authentication enabled,run the service as specific user etc;; etc;;;

Web.config of asp.net application

    <system.web>

    <identity impersonate="true" userName="xxx" password="123456789"/>

   <authentication mode="Windows"/>
    </system.web>

<system.serviceModel>
  <bindings>
   <basicHttpBinding>
    <binding name="BasicHttpBinding_ICubeDB" closeTimeout="00:20:00"
     openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
     allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
     maxBufferSize="1500000" maxBufferPoolSize="1500000" maxReceivedMessageSize="1500000"
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
     useDefaultWebProxy="true">
     <readerQuotas maxDepth="32" maxStringContentLength="656000" maxArrayLength="656000"
      maxBytesPerRead="656000" maxNameTableCharCount="656000" />
     <security mode="None">
      <transport clientCredentialType="None" proxyCredentialType="Windows"
       realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
     </security>
    </binding>
   </basicHttpBinding>
  </bindings>
  <client>
   <endpoint address="http://localhost/Cube/CubeDB.svc" binding="basicHttpBinding"
    bindingConfiguration="BasicHttpBinding_ICubeDB" contract="Scube.ICubeDB"
    name="BasicHttpBinding_ICubeDB" />
  </client>
   
 </system.serviceModel>

Web.config of WCF Service

<system.web>

    <identity impersonate="true" userName="xxx" password="123456789"/>

   <authentication mode="Windows"/>
    </system.web>

 <behaviors >
      <serviceBehaviors>
        <behavior  >
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

Code for Connecting WCF

Scube.CubeDBClient DB = new Scube.CubeDBClient ();
      


        public DataTable GetCellset(string connection, string strMDX)
        {
            //DB.Credentials = System.Net.CredentialCache.DefaultCredentials;
            DB.ClientCredentials.Windows.ClientCredential.UserName = "CSBLR\aravind.chandr";
            DB.ClientCredentials.Windows.ClientCredential.Password = "123456789";
           // DB.ClientCredentials.Windows.AllowNtlm = true;
           // DB.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

            DB.Open();
            DataTable dt = DB.GetCellset(connection, strMDX);
            DB.Close();
            return dt;

        }

Please help to resolve this ,with example much appreciated.

Thanks....


Bug in WCF DS Client 5.6 ResponsePipeline ExecuteOnEntryEndActions and ExecuteOnEntryStartActions

$
0
0

Hi,

The newly introduced configuration response pipeline has a bug in the implementation of the logic that calls the OnEntryStarted and OnEntryEnded actions. The problem is so severe that the functionality is useless. Let me describe the scenario that breaks the functionality...

Lets say we have a model with two entity types TA and TB. TA has a navigation property B that is a reference to one OR zero TB.

Now quering for TAs and expanding B gives an ArgumentNullException whenever an instance of TA is read that does not have an associated TB (or put in another way the property B is null) and you have specified some action for DataServiceContext.Configurations.ResponsePipeline.OnEntryStarted/Ended. The stack trace of the exception is this...

System.ArgumentNullException: Value cannot be null.
Parameter name: entry
	at System.Data.Services.Client.Util.CheckArgumentNull[T](T value, String parameterName)
	at System.Data.Services.Client.DataServiceClientResponsePipelineConfiguration.ExecuteOnEntryEndActions(ODataEntry entry)
	at System.Data.Services.Client.Materialization.ODataReaderWrapper.Read()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.TryRead()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.ReadEntryCore()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.TryReadFeedOrEntry(Boolean lazy, ODataFeed& feed, MaterializerEntry& entry)
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.ReadNavigationLink()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.ReadEntryCore()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.TryReadEntry(MaterializerEntry& entry)
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.<LazyReadEntries>d__0.MoveNext()
	at System.Data.Services.Client.Materialization.FeedAndEntryMaterializerAdapter.Read()
	at System.Data.Services.Client.Materialization.ODataReaderEntityMaterializer.ReadNextFeedOrEntry()
	at System.Data.Services.Client.Materialization.ODataEntityMaterializer.ReadImplementation()
	at System.Data.Services.Client.MaterializeAtom.MoveNextInternal()
	at System.Data.Services.Client.MaterializeAtom.MoveNext()
	at System.Linq.Enumerable.<CastIterator>d__b1`1.MoveNext()

Looking at the source code for System.Data.Services.Client.DataServiceClientResponsePipelineConfiguration.ExecuteOnEntryEndActions(ODataEntry entry) in IlSpy reveals the following... 

// System.Data.Services.Client.DataServiceClientResponsePipelineConfiguration
internal void ExecuteOnEntryEndActions(ODataEntry entry)
{
	if (this.readingEndEntryActions.Count > 0)
	{
		ReadingEntryArgs obj = new ReadingEntryArgs(entry);
		foreach (Action<ReadingEntryArgs> current in this.readingEndEntryActions)
		{
			current(obj);
		}
	}
}

The constructor for ReadingEntryArgs throws an ArgumentNullException if entry is null. In the scenario described we are hit by this because this code is called for the TAs property B that is null.

Team - please look into this.

Regards

Uffe

AppFabric-enabled WCF Data Service

$
0
0
Does anyone know how to implement AppFabric-enabled WCF Data Service as show in Ron Jacobs excellent blog post but with the new .Net 4.5  EventSource infrastructure?

VB.NET WCF DataServices Projection Query with Null Navigation Properties

$
0
0

Please save me from jumping off a bridge if I have to look at one more page of search results trying to find a solution to how to access null navigation properties in a WCF DataServices Query.  Basically, my table has several foreign keys, many of which can be null.  I am trying to query data to display in a grid and so I need to access the FK.name fields to display to the users instead of the FK integer stored in the table I am querying.  But since some can be null, I am getting errors accessing them.  I have tried, anonymous projections, creating a class to project into, etc but nothing works.

BTW, in the example below, ActivityTestDataset is just a quick class i built to test a typed projection and has nothing to do with a system.data.dataset.

GetFilterQuery = From FilteredActivity In Database.Activity
                              Order By FilteredActivity.StartDate _
                              Select New UHOM.Data.Datasets.ActivityTestDataset() With _
                                    {
                                    .ActivityID = FilteredActivity.ActivityID, _
                                    .ActivityTypeID = FilteredActivity.ActivityType1.ActivityTypeID, _
                                    .ActivityTypeName = FilteredActivity.ActivityType1.Name, _
                                    .ActivityTypeName_Short = FilteredActivity.ActivityType1.Name_Short, _
                                    .ActivityTypeDetailID = If(Not IsNothing(FilteredActivity.ActivityTypeDetail1), FilteredActivity.ActivityTypeDetail1.ActivityTypeDetailID, Nothing), _
                                    .ActivityTypeDetailName = If(FilteredActivity.ActivityTypeDetail1 IsNot Nothing, FilteredActivity.ActivityTypeDetail1.Name, Nothing) _
                                    }


WCF - size issues(?)

$
0
0

 I just create a service in wcf.
first version is ok. i got the answer on my test project -
on my ws 2nd version i add a little bit more info to the return  message (still far away of what the system must handle) as list of values.
what happens is that on the return of the message i got an exception "The underlying connection was closed: The connection was closed unexpectedly.".
In fact this only occurs after i add list of values to my answer. 

i read some stuff on internet, adding this to webconfig: 

<basicHttpBinding>
    <binding name="FileSenderService.StreamedBinding"
                 transferMode="StreamedRequest" maxBufferSize="65536"
                 maxReceivedMessageSize="2000000000" messageEncoding="Mtom"
                 receiveTimeout="00:10:00">
    </binding>
</basicHttpBinding

any help?

 

Preventing CROSS/OUTER APPLY from Data Services

$
0
0

There is a known issue in the Entity Framework that the certain scenarios might lead to the presence of CROSS APPLY and/or OUTER APPLY operators in the output query.
These scenarios are:
    • A correlated subquery with paging.
    • An "AnyElement" over a correlated sub-query, or over a collection produced by navigation.
    • LINQ queries that use grouping methods that accept an element selector.
    • A query in which a CROSS APPLY or an OUTER APPLY is explicitly specified
    • A query that has a DEREF construct over a REF construct.

As far as I am aware, the only databases that support these APPLY operators are SQL Server 2005 and later.
This issue has been around since at least 2008.
Since this issue has not been fixed for over 3 years, I would estimate that there is a low chance of it being fixed within the EF in the next few months.
Therefore what recommendations are there for getting around this problem? They fall in two categories:
    1. Change/Upgrade the backend database to support the APPLY operators, or
    2. Rewrite the LINQ
Option #1 is not viable at this stage.
Option #2 can be done when you are writing LINQ, but when exposing an OData DataService to external clients it is not as easily.

What can we include in our OData DataService usage guide so that clients of our DataService know what patterns of queries they can and cannot use?
"Try the DataService with the URL parameters you require, and if you get a message like "Oracle 11.1 does not support APPLY" then reformat the URL query" is not specific enough nor professional.

Additionally, is there any configuration within our Data Service code that we can insert that would minimize this issue?

FYI This issue is mentioned at:
http://stackoverflow.com/questions/2333645/outer-apply-is-not-supported-by-mysql
http://msdn.microsoft.com/en-us/library/bb896273.aspx
http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/1fed6b4e-d580-4c2d-a7e5-559ef0c13f1a
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/ae826dd9-1bab-4f64-a7ee-f082a2177346/
http://www.devart.com/blogs/dotconnect/index.php/entity-framework-user-request-review.html#fourth
http://www.devart.com/forums/viewtopic.php?t=18895
http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/5c96e00c-10fe-4481-824b-5bd781384ccd


Roll back WCF 5.6.0? Uninstall it? Help!

$
0
0

Ok, we just take on an offshore company to help with some of the work. And although they have no idea how, OData, Edm and Dataservices where upgraded to 5.6. That is a problem for our application which is going out on the 26 and we require at least a month's worth of testing.

I tried to roll back the install, upgraded the service references etc. I searched ever file of any extension in the project that I could find and made sure that 5.6 was gone. The application refuses to compile, it cannot find a 'Parse' method or a 'Format' method only available in 5.6. I deleted the service references, rebuilt the services project, and added them back, it referenced them as 5.6.

I admit I'm new to NuGet, and I need to know how to roll this back. The application is dead in the water.

Visual Studio 2013 and Entity Framework 6.0.1

$
0
0

Hello all,

I update my Entity Framework to version 6.0.1 Today.  I was already using WCF 5.6.0.  Now when I try to browse my data service, I get the following:

The server encountered an error processing the request. The exception message is 'Expression of type 'System.Data.Entity.Core.Objects.ObjectContext' cannot be used for return type 'System.Data.Objects.ObjectContext''. See server logs for more details. The exception stack trace is:

   at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression& body, ReadOnlyCollection`1 parameters)   at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, String name, Boolean tailCall, IEnumerable`1 parameters)   at System.Data.Services.Providers.DbContextHelper.CreateDbContextAccessor(Type type)   at System.Data.Services.Providers.DbContextHelper.GetDbContextAccessor(Type type)   at System.Data.Services.DataService`1.CreateMetadataAndQueryProviders(IDataServiceMetadataProvider& metadataProviderInstance, IDataServiceQueryProvider& queryProviderInstance, Object& dataSourceInstance, Boolean& isInternallyCreatedProvider)   at System.Data.Services.DataService`1.CreateProvider()   at System.Data.Services.DataService`1.HandleRequest()   at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody)   at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] )   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

I found that I might need to update the WCF Data Services Entity Framework Provider so I ran this at the Package Manager Console

Install-Package Microsoft.OData.EntityFrameworkProvider -Pre

From that I get the Following:

Install failed. Rolling back...
Install-Package : Could not install package 'Microsoft.Data.Services 5.6.0'. You are trying to install this package into a project that targets '.NETCore,Version=v4.5.1', but the
package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Microsoft.OData.EntityFrameworkProvider -Pre
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

So it seems the package for the new Microsoft Data Services doesn't work with projects that target a windows 8.1 app.  Is there a way to get back the older version of the Entity Framework?  Is there a way to make version 6 work?  I tried renaming the DataService Inheritance to EntityFrameworkDataService, but it can't find the namespace that contains that.  I am really stuck.  Any help with this would be greatly appreciated.

Jim


Jim Wilcox


WCF Service - WinForm Client question..

$
0
0

Hello!

I have two projects.. One is a WCF Service. The second a winforms project. I have created the files from the svcutil and added them to the winforms project (client).

Everything seems ok, I can create Service object from client. But when I run the client, I get an exception saying it could not find matching endpoint in WCFservice...

Let me state I am new to WCF service and am grateful for any help!

Custom OData Provider - ApartmentState.STA

$
0
0

Hi

We have written our own OData Provider for a COM library.

The owners of the COM library explained to me that there library is much faster if you query it when the ApartmentState is set to STA.

Is it possible to have our code in the Custom OData Provider executed in ApartmentState STA?

Thanks in advance

Kind Regards

Sander

GZip Data compression for ADo.NET Data Services

$
0
0

Hi

I have ADo.NET Data service hosted under IIS web directory (http:\\localhost:8080\Registers\Administration.svc)

I have faced huge network bandwidth when accessing page of data with multiple expands. The solution is to compress traffic from data service. Can you point me how to implement such behavior?

I have tried GZipMessageEncoding from WCF samples, but got the exception:

[ServiceActivationException]: The service '/Registers/Administration.svc' cannot be activated due to an exception during compilation.  The exception message is: The operation 'ProcessRequestForMessage' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.

Thanks,

Dima

Breezejs projection on Non-Mapped Property broken in new release

$
0
0

Hello All,

I am using Breezejs with Entity Framework and I have some entities where I added some Non-mapped properties using NotMapped Attribute. Before the latest update of Web API and OData, I was able to do projections on the non-mapped properties but since the last update of Web Api and OData, I am getting an error.

Here are more details.

Lets say I have an entity Order with properties OrderId, Total, etc

To this entity, I added a non-mapped property called OrderDisplayName and added the data annotation attribute [NotMapped].

Now, on the client side, I registered this property with Breeze by doing this

                 var type = store.getEntityType("Order");
                    if (type) {
                        var mappedOrderDisplayNameProperty = new breeze.DataProperty({
                            dataType: breeze.DataType.String,
                            defaultValue: null,
                            isNullable: true,
                            isPartOfKey: false,
                            maxLength: null,
                            name: "orderDisplayName",
                            nameOnServer: "OrderDisplayName"
                        });

                     
                        type.dataProperties = Enumerable.from(type.dataProperties).where(function (up) {
                            return up.name != "orderDisplayName";
                        }).toArray();

                        type.dataProperties.push(mappedOrderDisplayNameProperty);

                        
                        type.unmappedProperties = Enumerable.from(type.unmappedProperties).where(function (up) {
                            return up.name != "orderDisplayName";
                        }).toArray();
                    }

Now, I am trying to do a projection on a couple of properties using Breezejs like this


       var query = breeze.EntityQuery.from("Orders").withParameters({ keys: keys}).select("OrderId, OrderDisplayName");

                   
                    this.execeuteQueryAsync(query).then(function (promiseData) {
                       
                        var mappings = promiseData.results;
                       
                        });

I keep getting an error from BreezeQueryableAttribute's ValidateQuery method saying

Property named 'OrderDisplayName' cannot find found on type 'Order'.

This used to work fine before I did an update on Odata and Web API (2).

Could someone let me know what I would need to change or if this is a know issue with the update??

Thanks.

Invoking Service Actions

$
0
0

So, I have read the tutorials here: http://efactionprovider.codeplex.com/

My questions are:

Is it possible to send a new Entity from the client as a parameter to the Service Action?

It is not necessary to call SaveChanges in the Service Action?

We need to implement custom logic while saving a new entity in a transaction. So, one option we are exploring is a Service Action. Any input highly appreciated.

Thanks

Viewing all 877 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>