Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger generation fails for Entities having DataContractAttribute fails with "Sequence contains no matching element" when used in OData Actions. #197

Closed
kspbhat opened this issue Nov 28, 2020 · 1 comment

Comments

@kspbhat
Copy link

kspbhat commented Nov 28, 2020

I am using an action with the following definition. Here, I have added an entity having DataContract as an entity parameter to the action.

This generates the EDMType fullname as "Sample.Models.queueInfo". But the CLR Typename would still be be Sample.Models.QueueInfo.

As per my analysis, TypeHelper.cs has a static method - FindType that tries to find the Type based on EDM Type FullName. Since this method first loads all CLR Types and then compares with the EDMType full name, it fails with
Sequence contains no matching element error.

This method should do a case insensitive comparison in order to fix the issue.

Any thoughts / opinions in this regard is highly appreciated.

Action Definition:

var actionEnqueue = builder.EntityType<Document>().Action("enqueue");            
actionEnqueue.EntityParameter<Models.QueueInfo>("queueInfo");

Entity:

namespace Sample.Models
{
[DataContract(Name = "queueInfo")]
    public class QueueInfo
    {
        [Key]
        [DataMember(Name = "name")]
        public  string Name { get; set; }

        [DataMember(Name = "eventName")]
        public  string EventName { get; set; }      
    }
}

TypeHelper.cs

internal static Type FindType(string fullName)
{
	return GetLoadedTypes()
		.First(t => t.FullName.Equals(fullName));
}
@rbeauchamp
Copy link
Owner

Closing issues and archiving this project as no one has signed up to maintain it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants