Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9112757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:48:41+00:00 2026-06-17T03:48:41+00:00

I’m currently developing a site using Code First and Linq to entities. I Have

  • 0

I’m currently developing a site using Code First and Linq to entities.
I Have a custom model called Productos that contains a list of custom models called Especificaciones, wich also contains a custom model called Etiquetas. Etiquetas has a Property Called EtiquetaId.

This is an example of my models:

    public class ObjectProducto
    {
         public IEnumerable<ObjectEspecificaciones> Especificaciones { get; set; }
    }

    public class ObjectEspecificaciones
    {
         public IEnumerable<Etiquetas> etiquetas { get; set; }
    }

    public  class Etiquetas
    {
           [Key]
           [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
           public int EtiquetaId { get; set; }
           public string texto { get; set; }
    }

I Have an int array filled with values from a view, the array is called MyOptions.

I need to get all the Especificaciones that contains all Etiquetas with EtiquetaId inside MyOptions.

At this point i have retrieved all the Especificaciones that match with ANY of the values inside MyOptions, but i need the Etiquetas Inside Especificaciones that match by ALL MyOptions values.

I have the values from Productos, with all their Especificaciones and all of the Etiquetas inside all of Especificaciones already inside a var called procatm.

Currently my query looks like this:

ProductosCatalogo = 
    (from procatm in catm.ProductosCatalogo 
     where procatm.Especificaciones.Any(e => e.etiquetas.Any(et =>                
                                  et.tipo_etiqueta.CompareTo("categoria") != 0 && 
                                  et.tipo_etiqueta.CompareTo("tipo") != 0 && 
                                  MyOptions.Contains(et.EtiquetaId))) 
     select procatm).AsEnumerable()

I don’t know if i can make something like

ProductosCatalogo = 
    (from procatm in catm.ProductosCatalogo 
     where procatm.Especificaciones.Any(e => e.etiquetas.Any(et =>  
                                  et.tipo_etiqueta.CompareTo("categoria") != 0 && 
                                  et.tipo_etiqueta.CompareTo("tipo") != 0 &&
                                  MyOptions.All(...)..... 
     select procatm).AsEnumerable()

Can somebody helpme?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:48:43+00:00Added an answer on June 17, 2026 at 3:48 am

    I believe I din’t explained the question far enough..
    Only needed to check if an array of Etiquetas was a subset of another array, but all elements in opciones was contained in the tags Ienumerable.

    Found the answer 🙂

    Thanks to all the persons that submitted an answer 😀

    public bool IsSubsetof(int[] opciones, IEnumerable<Etiquetas> tags)
    { 
        int[] tagens;
        tagens= new int[tags.Count()];
        for (int i = 0; i < tagens.Length; i++)
        {
            tagens[i] = tags.ToArray()[i].EtiquetaId;
        }
        return !opciones.Except(tagens).Any();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.