Silverlight Error MatchTimeoutInMilliseconds: Allow DomainServiceClientCodeGenerator

Silverlight 5 .Net Framework 4

I am trying to implement a workaround for a recent error in the RIA code generator "MatchTimeoutInMilliseconds not found" https://connect.microsoft.com/VisualStudio/feedback/details/1988437/generated-code-for-silverlight-references-matchtimeoutinmilliseconds-which-does -not-exist

I am trying to use the Lazebnyy workaround , but I cannot get the DomainServiceClientCodeGenerator to solve.

Lazebny writes:

Install RIAServices.T4 from Nuget to WebProejct or to a class library that will contain code generation classes. PM> Install-Package RIAServices.T4

Create two classes

[DomainServiceClientCodeGenerator(typeof(MyServicesEntityGenerator),"C#")] public class MyServicesClientCodeGenerator : CSharpClientCodeGenerator { protected override EntityGenerator EntityGenerator { get { return new MyServicesEntityGenerator(); } } } public class MyServicesEntityGenerator : CSharpEntityGenerator { protected override void GenerateAttributes(IEnumerable<Attribute>attributes, bool forcePropagation) { List<Attribute> newAttributes = new List<Attribute>(attributes); List<Attribute> regularExpressionAttributes = (from c in attributes where c.GetType() == typeof(RegularExpressionAttribute) select c).ToList(); newAttributes.RemoveAll(delegate(Attribute attr) { return attr.GetType() == typeof(RegularExpressionAttribute); }); base.GenerateAttributes(newAttributes, forcePropagation); foreach (RegularExpressionAttribute item in regularExpressionAttributes) { base.Write(string.Format("[System.ComponentModel.DataAnnotations.RegularExpressionAttribute(@\"{0}\", ErrorMessage=@ \"{1}\")]\r\n", item.Pattern, item.ErrorMessage)); } } } 

Now, to tie it all together, in the Silverlight project file, we need to tell RIA to use our generator. We need to edit the Silverlight project and add the next element inside the first PropertyGroup right after the LinkedServerProject (the order doesn't matter, I just say that as a link).

 <LinkedServerProject>..\RIAServicesLibrary.Web\RIAServicesLibrary.Web.csproj</LinkedServerProject> <RiaClientCodeGeneratorName>RIAServicesLibrary.Web.Helpers.MyServicesEntityGenerator</RiaClientCodeGeneratorName> 

.

No matter what I try, I cannot resolve DomainServiceClientCodeGenerator

 [DomainServiceClientCodeGenerator(typeof(MyServicesEntityGenerator),"C#")] 
  • I received the Nuget RIAServices.T4 package version 4.2.0,
  • Added links in the service project on the server side Microsoft.ServiceModel.DomainServices.Tools.dll Microsoft.ServiceModel.DomainServices.Tools.TextTemplate.dll
  • I have included namespaces in the code

     using Microsoft.ServiceModel.DomainServices.Tools; using Microsoft.ServiceModel.DomainServices.Tools.TextTemplate.CSharpGenerators; using Microsoft.ServiceModel.DomainServices.Tools.TextTemplate; 

Delving into namespaces, all I can find is DomainServiceClientCodeGeneratorAttribute and IDomainServiceClientCodeGenerator

Can someone tell me how to resolve my missing DomainServiceClientCodeGenerator ?

+5
source share
2 answers

Finally, I started to work. The project needed links to System.ComponentModel.Composition

This key information is obtained from http://jeffhandley.com/archive/2010/10/28/RiaServicesT4WalkUp.aspx

You will notice that I need to add a link to Microsoft.ServiceModel.DomainServices.Tools for this. That the assembly is within our framework (and not the Toolkit) and where the DomainServiceClientCodeGeneratorAttribute class is defined. Also in order to compile this, I needed to add a reference to System.ComponentModel.Composition (MEF), because the attribute class actually comes from ExportAttribute.

...

(for someone wondering, this did not solve the MatchTimeoutInMilliseconds error for me)

+1
source

I spent about 4 hours to get the Silverlight 5 + Ria Services SP1 working draft created in Visual Studio 2012 + Windiws 7 + .NET Framework 4 in Visual Studio 2015 + Windows 10 to fix this error.

Initially, I could not get it to work in Visual Studio 2015 at all.

So, I installed Visual Studio 2013 (full type installation) + Service Pack 5 and I get fewer errors.

After that, I installed all the old Silverlight stuff like the WPF Toolkit , after which I just opened the solution, and the unique error was about

silverlight MatchTimeoutInMilliseconds error: allow DomainServiceClientCodeGenerator

Thus, without additional changes to the project properties, I installed .Net Framework 4.6.2 Preview

AND THIS ERROR REMAINED !!!

I compiled this solution, and after that I was able to compile it under Visual Studio 2015.

I hope the time I spent helps someone.

+5
source

Source: https://habr.com/ru/post/1240112/


All Articles