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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:54:22+00:00 2026-06-03T06:54:22+00:00

I need to transfer data from one DB to another. The destination DB contains

  • 0

I need to transfer data from one DB to another. The destination DB contains a much smaller amount of data than the source, and each table is only a subset of the source table’s columns. I just created the destination DBML, and I’m rightly getting a compilation error because the L2S data type (in the destination DBML) is the same as the L2S data type in the source DBML.

Is there a way to share these types between data contexts? If not, is there a way to cast the source type as the destination type so I don’t have to create mappers to map each source type to the destination type before saving to the destination DB?

To be clear, in the source DBML, I’m only including the necessary columns. That’s why the source and destination types are exactly the same, but they belong to their own DBMLs.

This exact same table is in both DBMLs:

enter image description here

This question has been a struggle to articulate correctly. Another way to ask this would be: “Can I get the data from the source table, and save it to the destination DB, using just one type from the source DBML?”

  • 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-03T06:54:24+00:00Added an answer on June 3, 2026 at 6:54 am

    As @David suggested create DBML in different namespaces and then use Automapper or write some code that generates the mapping (it’s really easy given your requirements).

    Is there a way to share these types between data contexts?

    No.

    If not, is there a way to cast the source type as the destination type
    so I don’t have to create mappers to map each source type to the
    destination type before saving to the destination DB?

    You have to create mappings – however, it’s really easy (properties have same names, types, etc.). I even think it would be easier without Linq2Sql or any other ORM.
    IMHO you should drop all constraints, FKs, etc., copy data on SQL Command level (generate this code yourself) and then recreate all constraints.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to transfer a column from one table to another. The source table
I need to transfer data from one table to another. The second table got
During last time I made many integrations (data transfer from one place to another,
I'm creating a socket program to transfer data from one pc to another, but
I need to transfer data daily from SQL Server (2008) to SQL Server (2005).
What is the best way to pass data from one .NET application to another
I need to transfer data from a PHP script on my local server to
I need a format to transfer data from program A to program B, and
For my current project in c# I need to transfer data from a SQL-Database
I am doing a one-way data transfer app from MS Access to a Rails

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.