.net – & # 39; IQueryable & # 39; does not contain a definition for & # 39; ToListAsync & # 39; and no extension method

I try that in my controller method

    public class SectionsTemplateController: Controller
// GET: SectionsTemplate
        public async task <list> GetEmptyPageTemplates ()
var sectionTemplatesStore = CosmosStoreFactory.CreateForEntity();
return expects to receive sectionTemplatesStore.Query (). Where (x => x.Name! = String.Empty) .ToListAsync ();


and my Poco:

    public class EmptyPageTemplates
public int Id {get; to adjust; }
public string name {get; to adjust; }
public list Sections {received; to adjust; }

public class sections
public CanvasSectionType SectionType {get; to adjust; }
public int Order {received; to adjust; }

The entire error is:

Severity Code Description Status of the project file line suppression
Error CS1061 & # 39; IQueryable# Does not contain a definition for & # 39; ToListAsync # and no extension method & # 39; ToListAsync #, which is a first argument of type & # 39; IQueryable & # 39; accepted& # 39; (missing a using directive or an assembly reference?) TenantManagementWebApi C:  users  levm3  source  repos  TenantManagementWebApi  Controllers  SectionsTemplateController.cs 20 Active

.net – iteration over combinations


The following describes the problem of the real world that my code is supposed to solve. It may help you to understand what the code is doing and why. I do not think that this is absolutely necessary to verify the code. Continue with the "Problem" section.

I have an application that creates a season plan for a sports league. There are two places where all possible combinations of a certain number of objects selected from a larger set of objects must be processed.

  1. If there are clubs participating in each tournament (T <L) in league L and in T, all possible tournaments will be processed. This requires selecting all combinations of T-objects selected from a set of L-objects without repetition (a club is either at a tournament or not, it can not be there twice).
  2. If there are S rounds in the season and C possible configurations of a round are possible, all possible seasons have to be processed. This requires selecting all combinations of S objects that are selected from a group of C objects, where repetitions are allowed (in a season, there may be more than one round with the same configuration).

In both cases, I can create a list of objects from which to choose. Now I just have to deal with the index numbers of the objects in the list (instead of the objects themselves). I intend to process all possible combinations, so I need a way to go through the set of combinations.


Create a class that implements IEnumerable (of integer) This returns all possible combinations of r-integers selected from the first n non-negative integers, with the option to allow or deny retries. I also want to provide a property that calculates the number of possible combinations.


& # 39; & # 39; & # 39; Represents a set of possible combinations of integers

Public class combinations
Implements IReadOnlyCollection (Of integer ())

Private ReadOnly choose, totally As Integer, repeat As Boolean

& # 39; & # 39; & # 39; Create a new combination object
    & # 39; & # 39; & # 39; Number of articles to be picked
    & # 39; & # 39; & # 39; Number of items to choose from
    & # 39; & # 39; & # 39; True, if articles can be selected more than once
    & # 39; & # 39; & # 39; & # 39; pick & # 39; may be zero. In this case, null combinations are returned
    Sub New (pick as integer, pickFrom as integer, allowRepetition as boolean)
If pick <0, throw a new ArgumentException (
"Number of elements to be selected must be a non-negative integer", "Selection")
If pickFrom <= 0 Then Throw New ArgumentException(
            "Number of items to pick from must be a positive integer", "pickFrom")
        If Not allowRepetition And pick > pickFrom Then throw new ArgumentException (
"The number of articles to be picked may not exceed the number of articles that are" picked "by" picking ". "

repetition = allowRepetition
Select = Pick
total = pickFrom
End Sub

& # 39; & # 39; & # 39; Returns the number of possible values
    & # 39; & # 39; & # 39; The number of possible values ​​exceeds Integer.MaxValue
    Public ReadOnly Property Count As Integer Implements IReadOnlyCollection (Of Integer ()). Count
Return CInt (LongCount)
End received
End Property

& # 39; & # 39; & # 39; Returns the number of possible values
    & # 39; & # 39; & # 39; The number of possible values ​​exceeds or approaches Long.MaxValue
    & # 39; & # 39; & # 39; This replaces IEnumerable's LongCount extension method, which iterates through the entire collection
    Public ReadOnly property LongCount As Long
If you select <1 then return 0. If you choose 0 combinations, count must be 0, not 1

Dim minNumer As Long = If (Repeat, Sum - 1, If ​​(Select <Sum - Select, Sum - Select).
Dim maxDenom As Long = If (Select Repeat, If (Select <Sum - Select, Select, Sum - Select.))
Dim result As Long = 1

For iter As Long = 1 to maxDenom
result * = minnumer + iter
Return result
End received
End Property

& # 39; & # 39; & # 39; Gets the enumerator that can be used to select any possible value
    Public Iterator Function GetEnumerator () As IEnumerator (Of Integer ()) Implements IEnumerable (Of Integer ()). GetEnumerator
If you select <1 then quit function & # 39; If you select 0 combinations, exit without specifying a value

Dimming value (choose 1) as an integer
If no repetition, then value = Enumerable.Range (0, select). ToArray
Dim index As Integer = select - 1

income value
# Finish when the iteration is completed
If Value (0) = Sum - If (select Repeat 1), then exit

Find the rightmost element that can be raised and increase it
Dim oldIndex As Integer = Index
Do While Value (Index) = Sum - If (repeat 1, select - index)
Index - = 1
Value (index) + = 1

Wenn If the index has changed, reset all elements to the right of the new index
If index <> oldIndex Then
Index + = 1
Value (Index) = Value (Index - 1) + If (Repeat 0, 1)
Loop to Index = Select - 1
End function

& # 39; & # 39; & # 39; Non-generic method required for compatibility
    Private Function GetEnumerator1 () As IEnumerator Implements IEnumerable.GetEnumerator
Return GetEnumerator ()
End function
End class

Please for review

I'm pleased to hear about suggestions for improving the processing speed or readability of the code, as well as about errors I've overlooked, or user interfaces that could be improved. There are also some specific areas where I'm not sure I've made the right decision, and I would appreciate your comments.

  1. The class implements IReadOnlyCollection (of integer) rather than IEnumerable (of integer) as the former offers one number Property. The latter has one number Expansion method that goes through the collection to count the elements (and therefore may be slow for large collections), I believe through the implementation IReadOnlyCollection (of integer)I signal to the user that my number Property is pretty efficient.

  2. The number of possible combinations can quickly become very large, so in addition to one number Property that returns a IntegerI offer one Long Count Property that returns a Long, In both cases, I allow one OverflowException throw if the number of combinations is too high. I think I made sure I avoided everyone OverflowException in other cases, by alternating multiplication and division operations during the calculations.

  3. I have decided that the user can specify to select nulls (and in this case, the iterator function terminates without anything giving in. In my application, the number of elements to pick is calculated and could be zero Nullobjekten works for me, but I'm not sure if it makes sense for another user.

  4. I am forced to implement the non-generic IEnumerable.GetEnumerator Function and did it with that GetEnumerator1 Function. This looks strange to me, is there a better way to meet the requirements of the interface?

asp.net – How to convert this .NET cryptography code into the openssl command?

How do I sign the message with the signer's private key using the openssl command-line tool to get the same result as the following code?

using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography;

static public byte[] SignMe (X509Certificate2 rsa_cert, Byte[] Embassy)
ContentInfo ci = new ContentInfo (message);
SignedCms scms = new SignedCms (ci, true);
CmsSigner signer = new CmsSigner (rsa_cert);
scms.ComputeSignature (signer, false);
return Convert.ToBase64String (scms.Encode ());

Web API hosting with database using .Net

I have a scenario:

  1. Use .NET Framework or .NET Core and develop Web API
  2. It also has a database for storing data, eg: SQL Server
  3. It has to be installed on the client side


  1. How can I protect my code or how can I provide a solution?
    on client so license should work
  2. Client can have Windows or Linux (therefore the operating system should be OS

I prefer to use .Net Core and SQL Server, but have no idea about packaging with backing up my code and client-side database deployment.

Please advise.

Many Thanks 🙂

Android Studio error: java.lang.NoClassDefFoundError: net / miginfocom / layout / PlatformDefaults

I recently unzipped the latest Windows 10 32-bit version of Android Studio and followed the instructions to run the program. Everything was unpacked properly. When I started the Android Studio application, there was an error. This is how it looks like:

Internal error. Please log in to https://code.google.com/p/android/issues

java.lang.NoClassDefFoundError: net / miginfocom / layout / PlatformDefaults at com.intellij.idea.IdeaApplication.patchSystem (IdeaApplication.java:174) at com.intellij.idea.IdeaApplication .idea.MainImpl $ 1.lambda $ Start $ 1 (MainImpl.java:45) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl (EventQueue.java:762) at java.awt.EventQueue.access $ 500 ( EventQueue.java:98) at java.awt.EventQueue $ 3.run (EventQueue.java:715) at java.awt.EventQueue $ 3.run (EventQueue.java:709) at java. security.AccessController.doPrivileged (Native Method) at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege (ProtectionDanain.java:80) at java.awt.EventQueue.dispatchEvent (EventQueue.java:732) at java.awt.Arch.Akt. EventDispatchThread.java:201) for java.awt.EventDispatchThread.pumpEventsForFilter (EventDispatchThread.java:116) for java.awt.EventDispatchThread.pumpEventsForHi hierarchy (EventDispatchThread.java:105) for java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java: 101) for java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:93) for java.awt.EventDapratcheadracheadrone: 82) Caused by: java.lang.ClassNotFoundException: net.miginfocom.layout.PlatformDefaults on com.intellij.util.lang .UrlClassLoader.findClass (UrlClassLoader.java:224) at java.lang.ClassLoader.load.Access.Arbeiter: 424) at java.lang.ClassLoader.loadClass (ClassLoader.java:357) … 17 more

Please help I dont know what java.lang.ClassNotFoundException means.

C # .NET API Design – Interfaces vs. DTOs

I'm designing a relatively simple web application with .Net Core. So far, my main focus in my career has been desktop development, so I am a bit new in the nuances between desktop and web development.

In this application, there is a business logic layer and a presentation logic layer that inherits the business logic and transforms the properties into a marked output server page and then returns the data to the client through a Web API.

Because of the controls I use and the structure of the application, it makes sense to have this "presentation logic" layer on the server side because some aspects of the presentation represent actual business logic requirements (most of the presentation is handled in views, subviews, and view components) ,

Currently, I'm addressing this by injecting the business logic classes into presentation logic classes and then returning an API to the presentation logic class.

A simplified example of the approach:

public class BusinessLogic
public string PropertyA {get; to adjust; }

public string PropertyB {get; to adjust; }

public void DoSomeLogic () {// some code here}

public class PresentationLogic: IPrepresented
Private BusinessLogic Business Logic;

Public Presentation Logic (BusinessLogic BusinessLogic)
this.businessLogic = businessLogic;

public string PresentationPropertyA
Return ""+ this.businessLogic.PropertyA +"";

public interface IPresented
String PresentationPropertyA {get; }

[Route("api/[controller]")]public class MyController
  public IPresented Get ()
var businessLogic = new BusinessLogic ();
// edit businessLogic
return new PresentationLogic (businessLogic);

The API provides interfaces that are implemented by the PresentationLogic classes. As far as I understand, these interfaces are serialized in JSON and returned to the page to use within their controls.

Another approach to solving the same problem would be to create a DTO, and the PresentationLogic class must take the business logic and spit out the DTO, adding additional markup to the properties when creating the DTO. For example:

public class PresentationLogic
public Dto GetDtoFromBusinessLogic (BusinessLogic businessLogic)
to return new dto {PresentationPropertyA = ""+ this.businessLogic.PropertyA +""};

public class Dto
public PresentationPropertyA {get; to adjust; }

[Route("api/[controller]")]public class MyController
  public Dto Get ()
var businessLogic = new BusinessLogic ();
// edit businessLogic
var presentationLogic = new PresentationLogic ();
return presentationLogic.GetDtoFromBusinessLogic (businessLogic);

What I want to know is what advantages or disadvantages each approach has.

As far as I understand, both controller methods effectively return the same JSON to the calling page.

The first approach feels more natural to me for the following reasons:

  • I do not like DTOs unless they are absolutely necessary because I think they tend to promote anemic domain models
  • The presentation logic class becomes an adapter class, located between the business logic and the view. It has a clearly defined responsibility.
  • I did not create classes just to act as a return type – it feels like less code wastage.
  • I could possibly add new properties to the PresentationLogic class and implement a new interface if Version 2 requires changes.
  • Interfaces act like a natural tool for the abstraction of C # code.

I've discussed this with other developers, and they said returning to a DTO is the more common way to tackle this problem. I found some reasons why this could be a better approach:

  • DTOs are clearly labeled as such, and no one is tempted to add a breaking logic to them.
  • If this is the default method, this will help new developers get up to speed.
  • Adding a new version forces the use of a new DTO class. This means that there is less potential to make groundbreaking changes (although this can be done with the other approach if needed).

Note that this question is generally a multi-layered web architecture, rather than my requirements for this project. If presentation logic does not need to be added on the server side, this question could easily be based on business logic and persistence logic classes.

So what's better – DTOs in a Web API or interfaces for complex objects in a Web API?

C # – Is WuapiLib compatible with .Net Framework 2.0?

I need to create a console application that uses WuapiLib, I list pending updates, download these updates, and install these updates (all configurable via parameters).

The thing is that it has to be compatible with .Net Framework 2.0 … and I can not find any information to tell me if this library will be.

I've rarely faced C #, so forgive my awkwardness.

Thank you

.net core – signal r in the Azure service structure

I have a service fabric application with 2 microservices. One of them is a front-end service (using "angle") and the other is a back-end service (ASP.Net Core Web API).

The backend service uses signalr to send data to the frontend service. In my local development, everything works as expected, but when I upload the application to the portal, the calls to signal r are sometimes successful and sometimes fail

I have already tried the following
I have only one instance of frontend and backend services
I've set session persistence to clientip in the load balancer (for the backend service rule).

The problem remains. help please