.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

CommunicationException when serializing my business POCO object

Posted By:      Posted Date: September 06, 2010    Points: 0   Category :WCF
Hi! I'm currently blocked by a strange problem, here is the situation: I've a client and a server, running with .Net 4.0 framework. I'm using Entity Framework server side, and WCF to communicate between client and Server. I use POCO object on my Entity Framework model. One month ago, I had a problem: In some case entity framework has already loaded an object and then want to return it when the WCF service is queried. Example: An User has a collection of Orders, and Orders knows which User handle it---> cyclic references I searched online how to resolve this and I found this: http://chabster.blogspot.com/2008/02/wcf-cyclic-references-support.html It worked like a charmed for me until now. I can get data from the server without server, ... Now I'm trying to call my Save(User) method from the client to the server, and I get this error:   System.ServiceModel.CommunicationException was caught Message=There was an error while trying to serialize parameter http://tempuri.org/:User. The InnerException message was 'Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract name 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribu

View Complete Post

More Related Resource Links

System.StackOverflowException occur while Serializing Business Object which implements INotifyProper

I try to implement the NTier scenario for a sample application using Remoting, but while try to implement this it giving me the error that SOAP serializer doesn't support serialization of generic List of....blah blah,,,
So I decided to implement my own serialization process like mentioned below and it works fine,

This is the Interface of the DataCentric Component
 obj As
 Custs) As

'This is where I want to talk to database(haven't implemented yet in this code)<br/>


 obj As

Business object design in master details.


Hello guys, I have the following scenario,

  1. There is a master business object containing 40 fields
  2. 2 separate child business objects
  3. If I update a child record, I have to update master's 'Last modify by' status along with 3 or more fields in master
  4. For this purpose, I don't want to initialize a separate Master class object (as most of the fields are unused/wasted)
  5. The 'last modify by' also gets updated if the records in master get updated themselves

Currently I have separate business objects for master table, Child 1, Child 2 etc.

How do I control this in my business object design ? Do I break up my master object ? Say I extract last 'modify by ' into a new class, through inheritance or some other way ?

Is there a way that whenever child gets updated I use a 'small' class to update Master status only and whenever the master itself gets updated I do the same.

Problem is that I am having redundancy in my small class (Master class also contains 'Last Modify By ',

What would you advice. Please have your say. Thank you.

Edit  I am using webforms guys.

Managing business object locks on application level

Today I worked out simple application side object locking solution for one server scenario. My motivation came from ASP.NET architecture forum thread How to solve concurrent site issue where one user asks for locking solution that works without changing database. Here is my simple and primitive solution that should help this guy out. I added also sample solution to this posting. My solution is simple: Create class for locked items. Create manager class that holds locks and manages them. Clear locks when session ends. Create page to release all locks. If you need something more serious then you should keep locks information in database or better than that - use some lock server. Also you may consider developing WCF service. LockItem class As a first thing let's create class that keeps lock information. I call this class as LockItem. This class doesn't hold references to locked objects - only type and ID as there are many business layers that doesn't use globally unique identifiers for objects. public class LockItem {     public Type ObjectType { get; set; }     public int ObjectId { get; set; }     public string SessionId { get; set; }     public DateTime LockedAt { get; set; } } LockItem class also contains property for session because otherwise it is not possible to kno

Two Copies of an object when choosing business object in objectdatasource


I'm having a problem that I cannot resolve.

I have created a business object that I have placed in my web apps app_code directory.  When I try to reference this object with the objectdatasource 'configur datasource' wizard I see two copies.

If I select one and run I get the following exception:

The type 'SPFSimulatorWeb.App_Code.ModuleBLL' is ambiguous: it could come from assembly 'C:\Users\myusername\AppData\Local\Temp\Temporary ASP.NET Files\root\95af94a9\fff6b138\App_Code.y7vbcqg4.DLL' or from assembly 'C:\Users\myusername\Simulator Development\SimDevelopment\SimulatorWeb\bin\SimulatorWeb.DLL'. Please specify the assembly explicitly in the type name.

I believe that this problem started after I switched one of the references from an .exe from another project to a DLL.  Now I see two copies of whatever the class I make in my App_Code directories.  I have tried deleting the temporary folder but the same error results.  I have even removed the web application from my solution and deleted it, started a new web app, renamed my business object class but the same thing happens. 

I'm pulling my hair out over this.  Has anyone ever seen anything like this?  I've read some of the other threads where they just deleted files or cleaned there solutions but that has not w

DataBinding not updating underlying business object when changing control property from code


I have a custom data form control that in code generates databindings between the selected custom business object (LLBL) and the various controls on the screen. Everything works in that I set the DataContext to the selected business object and the data appears in the GUI. If the user changes anything on screen, the data is getting updated into the business object.

However, now I have some custom logic that when the user presses a button I need to update some fields. Currently I'm setting this data directly into the controls, setting the new value into the property that is bound. However, the data is not getting pushed back into the business object.  I had this same issue building WinForm apps in that databinding only fired if the user was in the control and left it.

Does the same thing apply to WPF? How can I get ANY change on say a TextBox's Text property whether via user interaction or from C# code to push that value into the bound business object property?


ObjectDataSource Update using business object/entity.


I have an ObjectDataSource that I want to perform updates using a business entity (i.e. Type="Object"). Since the values for the entity are within a user control, I have stored a reference to the control in Session and in the updating event, set the new instance to the value of the entity from the user contol property (which also pulls values from the form via other properties of the control):

Protected Sub MasterDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles MasterDataSource.Updating

    Dim entity As New Login()

    Dim accountControl As AccountInfo = TryCast(Session("AccountCtrl"), AccountInfo)

        entity = accountControl.Entity

        e.InputParameters.Add("entity", entity)

End Sub

And here's the markup for the datasource:

Desing of Hijri/Gregorian Converter Business Object / Class using .NET.


I am developing a Business Object using .NET to perform Conversion from/to Hijri/Gregorian Calendar. Although there is a class in .NET for this purpose, but, still there is a good chance there will be a mistake by at least one day +/- in few cases. In any case, I may depend on this class for conversion, when needed. On the other hand, I already developed this conversion logic under MS Access, and I want to re-use parts of the work done of it in .NET. 

I will post the BO specs summary here to give you an idea about the requirement, so that I can get your feedback, and I will be posting questions mainly related to how to make this BO most efficient, because eventually it will be exposed via a web service.

The Database:

I am storing the required data in tables in MS Access DB, and following is a sample of such tables:


Business Object properties and Session Variable



I'm having trouble getting the properties of a Business Object between pages.  Right now on the main page's button click event, I instantiate a Business Object, assign its properties with user inputs, store it in Session Variable and open a popup via window.open.  On the popup I retrieve the Session variable and cast it to the business object and try to access its properties.

However in the popup Page_Load event, all the properties of the business object is returned as null.  I have no problem using this method with simple strings/integers instead ot the business object.  I'm not sure how to go about this, any suggestions?

Here's my code example:

// Button click event in main page        
protected void btnViewReport_Click(object sender, EventArgs e)
            ReportObj auditReport = new ReportObj();
            auditReport.PropA = 1;
            auditReport.PropB = "hello";
            auditReport.PropC = DateTime.Now;
            auditReport.PropD = new int[] {1,3,10,87,23};

Specifying the finder method for a business data connected list column's object picker.



I have a BDC xml file which specifies a finder and a specific finder method. These both work fine.

What I want to do is configure the application so that when connected to a list column the object picker uses my finder method rather than the specific finder method which it defaults to. Is this possible?

For further explination if you look at the following image http://i56.tinypic.com/2n22o3m.jpg

If I want to find the department using the objet picker I have to type the full identifier.

If I click the browse (address book icon) to popup the browse window I can then use my finder method. I want the initial object picker to use my find method and if there multiple matches be able to pick one using the popup you get when the message "No exact match was found." is displayed.

Hope this makes some sense!

Cheers Dave

Subject: BUG? Empty Business Object when Configure ObjectDataSource


I would like to bind an ObjectDataSource control in my page to a method of 
one of the existing classes in my App_Code folder. However, when I go 
"Configure Data Source..." for this control, the wizard shows an empty 
drop-menu for business object, and I can't choose any of my classes

All my classes in the App_Code compile successfully and I don't understand 
what is causing this problem. Is there a bug?


Xml serializing an object that implements INotifyPropertyChanged


Is there any way around this bug, I get the error


System.InvalidOperationException : Unable to generate a temporary class (result=1).
error CS0012: The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.


I have tried applying the Attribute [XmlInclude(typeof(INotifyPropertyChanged))] with no luck.

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

Business Modelling and Web Applications and extending UML

UML can be used to model a business, prior to automating it with computers. The same basic UML syntax is used, however, a number of new symbols are added, in order to make the diagrams more relevant to the business process world. A commonly-used set of these symbols is available in current versions of Rational Rose.

C# Object Oriented Programming

So far in C# Essentials we have looked at the basics of programming in C# such as variable types and flow control. Although it would be possible to write a functional program using these techniques, there is much more to becoming a proficient C# programmer. C# is, above all, an object oriented programming language and as such any C# programmer will be expected to create object-oriented applications using this language.

Object Oriented Programming

Four core concept of OOP Object Oriented Programming. 1.Inheritance, 2.Polymorphism, 3.Abstraction and 4.Encapsulation

Object-Oriented Programming Concepts

This is the first in a series of articles describing the use of object-oriented programming techniques as implemented by the C# programming language. This series follows the C# Fundamentals tutorial that beginners are advised to read first.

Overview of SharePoint Object Model

SharePoint offers a set of structured server-side objects those are widely used to program SharePoint Applications. These objects are hierarchically arranged and you can drill down through the object hierarchy to obtain the object that contains the components of SharePoint Application you need to use in your code.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend