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 8053035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:43:35+00:00 2026-06-05T07:43:35+00:00

I have Model like this interface IStudent { string Name; List<Subjects> Marks; int RollNumber;

  • 0

I have Model like this

interface IStudent {
   string Name;
   List<Subjects> Marks;
   int RollNumber;
}

class ViewModel {
   ObservableCollection<IStudent> FromExcel;  
   ObservableCollection<IStudent> FromDB;
}

I need to bind the union of both collection on UI. Whats the best way. I was thinking of having another property ObservableCollection<IStudent> FromBoth; generated using LINQ Union method with comparer. My question is

  1. Is it fine to have three collection to bind on UI? Note: I need to remove duplicates, giving priority to data from excel.

  2. I need to pick some data from DB rather than excel in certain case.

For example: name=”hungrymind” in fromExcel and name=”hungrymind concepts” on fromDB collection. By default, grid on UI should show hungrymind (priority to excel), but if user uncheck column(aka property) from UI, then priority to data for that column becomes DB, i.e, UI should show “hungrymind concepts”

What should be approach to achieve this. My approach would be on user event, pick data from FromDB or FromExcel for each items in the collection and assign it to property in FromBoth collection. Since there are more than 100 columns, I had to use reflection, but wouldn’t be slow down the performance? If I avoid reflection, then I have to write a method for each column. Any suggestion on pattern or approach ?

  • 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-05T07:43:36+00:00Added an answer on June 5, 2026 at 7:43 am

    I solved the issue like this

    interface IStudent {
       string Name { get; set; }
       List<Subjects> Marks  { get; set; }
       int RollNumber  { get; set; }
    }
    
    class EntityViewModel: IStudent {
       IStudent FromExcel;  
       IStudent FromDB;
       public string Name {
         get { return Choose("Name").Name; }
         set { Choose("Name").Name = value; }
       }
       public string RollNumber{
         get { return Choose("RollNumber").RollNumber; }
         set { Choose("RollNumber").RollNumber = value; }
       }
       internal IStudent Choose(string propertyName){
         if(IsOveridable(propertyName))
            return this.FromExcel;
         else 
            return this.FromDB  
       }
    }
    class ViewModel{
       ObservableCollection<EntityViewModel> Entities;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple model like this: class Auction(models.Model): name = models.CharField() class Item(models.Model):
I have a model basically like this: class Unit(models.Model): name = models.CharField(max_length=64) class UnitPrice(models.Model):
I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
I have a model that looks like this: public interface IEntity { int Id
I have an entity in my core data model like this: @interface Selection :
I have a Model like this: class MyModel attr_accessor :size end Now i want
I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A
I'm using MVC3 and I have a model like this: public class Foo {
I have a model class like this: class Note(models.Model): author = models.ForeignKey(User, related_name='notes') content
I have a model like this: class Entity(models.Model): entity_name = models.CharField(max_length=100) entity_id = models.CharField(max_length=30,

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.