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

  • Home
  • SEARCH
  • 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 4620862
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:37:04+00:00 2026-05-22T02:37:04+00:00

My system has this pattern DAO->Objects->facade->View so i have a DAO to query database,

  • 0

My system has this pattern DAO->Objects->facade->View

so i have a DAO to query database, and instantiate objects, this objects has only attributes (just a container / entity), i want to use LINQ in DAO part, but i dont realize how to pass my objects becouse LINQ generate 1-per table.

namespace ykpObjects.Objects
{
public class Customer
    {
        public string name { get; set; }
        public Cidade()
        {
            cidadeID = 0;
        }
    }
}

namespace ykpData.Components.MSSQL
{

    public class CustomerDC : DataComponentCM, ICustomerDC
    {

        Customer ICustomerDC.RecuperaPorID(int CustomerID)
        {
            Customer Customer = new Customer();

            using (MDDataContext omd = new MDDataContext(base.PreencherConexao()))
            {
                sp_mkp_Customer_SelectByIDResult result = omd.sp_mkp_Customer_SelectByID(CustomerID).SingleOrDefault();
                if (result == null)
                    return null;

                Customer.name = result.name;


                return Customer;
            }
        }
    }
}

I use DAO to call sprocs, so i get sproc results and instanciate a object of Customer for exemple, and pass this to control, now i want to change to linq but i dont wanna change all object structure to minimalize the impact.

Any advice ?

  • 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-05-22T02:37:05+00:00Added an answer on May 22, 2026 at 2:37 am

    I’m not exactly sure what you are talking about with your current setup, but I think you’re asking how to re-use the objects you currently have with Linq to SQL, rather than generating new ones from a dbml file. Am I right?

    If so, you have a few options. You can use attributes to decorate your existing objects so that you can populate them with L2S, or you can create mapping files.

    Some info here: http://www.sidarok.com/web/blog/content/2008/10/14/achieving-poco-s-in-linq-to-sql.html

    I use Linq to SQL with attributes to achieve a “code first” solution, here’s an example class:

    [Table(Name = "Countries")]    
    public class Country
    {
        [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
        public int CountryId { get; set; }
    
        [Column]
        public string iso2 { get; set; }
    
        [Column]
        public string iso3 { get; set; }
    
        [Column]
        public string name_en { get; set; }
    }
    

    To work with this object:

    var context = new DataContext(ConnectionString);
    var data = context.GetTable<Country>().Where(c => c.CountryId == 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a system that has a Mysql database with about 2Gigs of data.
i get this error {Method 'System.DateTime ConvertTimeFromUtc(System.DateTime, System.TimeZoneInfo)' has no supported translation to SQL.}
I have a large .NET web application. The system has projects for different intentions
I have a web system which has a classical parent-children menu saved in a
The Free MS Windows replacement operating system ReactOS has just released a new version.
So I have a desktop application designed using the MVC pattern inspired by this
I have a class that creates and uses a System.Threading.Timer, something like this: using
The bugzilla (perl-based) system has a feature to login automatically by using a http
How do I detect if the system has a default recording device installed? I
According to select name from system_privilege_map System has been granted: SELECT ANY TABLE ...and

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.