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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:52:50+00:00 2026-06-10T02:52:50+00:00

I have a class generated by Linq2Sql: public partial class BuyerOrder : INotifyPropertyChanging, INotifyPropertyChanged

  • 0

I have a class generated by Linq2Sql:

public partial class BuyerOrder : INotifyPropertyChanging, INotifyPropertyChanged

I want to clone object of this class, like it’s done in this post. For this purpose I define the partial class in not generated file, which I mark as serializable:

[Serializable]
public partial class BuyerOrder    

But when I’m calling

formatter.Serialize(stream, source);

I’m getting an exception, saying that this class is not marked as serializable. What am I doing wrong?

  • 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-10T02:52:51+00:00Added an answer on June 10, 2026 at 2:52 am

    If you want to serialize a LINQ-to-SQL type, then tell the code-gen to emit serializable data. You can do this in the DBML, or more simply in the designer – just set the serialization mode to unidirectional (this is the @Serialization attribute on the root <Database> element in the DBML).

    This will generate attribute markers suitable for use with DataContractSerializer; LINQ-to-SQL is designed to be serializable with DataContractSerializer. It is not designed to be serializable with BinaryFormatter.

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

Sidebar

Related Questions

I have a partial class being generated by a tool. Foo.cs public partial class
I have an employee class generated by Entity Framework (EF). public partial class employee
i have the following code: /** * @generated */ public class foo ... /**
I have a class generated from a WSDL that has a bunch of public
Is there a way I can have a generated code file like so: public
I have class X that implements Queue. I want to pass Class X's Object
I have a partial class generated from EF4 that I assign a MetadataType in
I have a Subsonic3 Active Record generated partial User class which I've extended on
When I compile something like this: public class MyClass { void myMethod(String name, String
I have generated class diagram by gight clicking and selecting generate class diagram usign

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.