Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Web-Service crashes after minor change to underlying database and entities
    primarykey
    data
    text
    <p>I've been bashing my head on this for quite a while and I'll really appreciate some help.</p> <p>I am writing a website using ASP.NET. The Business Layer is separated into two parts: BL-Server and BL-Client. The BL-Server in actually a WCF-Service that is there to shield the Data Access Layer and the DB. The WCF-Service is connected to the DAL that in turn reads from the DB. We are using MSSQL.</p> <p>Problems began after making a minor change to one of the tables of the DB (Adding a bool column to table "Responses").</p> <p>Suddenly, every time i request information through the WCF-Service, i get the following exception: "System.ServiceModel.CommunicationException was unhandled by user code Message=The underlying connection was closed: The connection was closed unexpectedly."</p> <p>This is kind of weird because the error occurs even when i request data from a different table (such as "Departments").</p> <p>I've done some digging, and after setting a trace to the WCF-Service (see: <a href="http://forums.asp.net/t/1476129.aspx/1" rel="nofollow">http://forums.asp.net/t/1476129.aspx/1</a>), i found out that the problem in the WCF-Service that caused it to suddenly close the connection was a buffer overflow. When trying to load the objects to the return buffer, the service throws the following exception: "Writing an object with a recursive structure has limitations when it has large depth. Consider reducing the depth of the object."</p> <p>That lead me to put a break point in the DAL method that loads the "Departments" data and examine the object that was about to be sent through the WCF-service.</p> <p>Turns out the object has some loops in it. You can go through it's elements in an infinite loop, since "Departments" has some children elements that point back to him.</p> <p>That seamed weird to me, so i checked the .dbml file, an walla - "Departments" has a list of entities that point to it. This, i found out, could be enabled/disabled in the link's (between the two entities, in the .dbml file) properties. The property is called "Child Property" and when enabled, ads a list of objects that have a foreign key to it to the element. (Example: if A has a FK to B. The B element will have the following member: <code>private EntitySet&lt;A&gt; _A;</code>)</p> <p>At this point one might think that the solution would be to set all the "child property" for all the links between the entities to false. But that ends up with other exceptions such as: "System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException was unhandled by user code Message=Operation is not valid due to the current state of the object." (thrown by the entity).</p> <p>Moreover, i don't want to mess with the .dbml file. I know that everything was fine before the MINOR change to the "Responses" table, and i find it hard to believe that a minor change in one table can cause so much of a mess in the entities' code.</p> <p>I'm sorry for the long post, but this issue is driving me crazy, and i wanted to make sure i give all the relevant information.</p> <p>Note: the application's structure is a prerequisite and i can't change it, so let's not go into that, please.</p> <p>Thanks in advance, SummerBulb </p> <p>Update: Since I'm using source control, i was able to compare the old "BusinessElements.designer.cs" and the new one. I found that the old file contains lots of code that deals with serialization. For example: <code>[global::System.Runtime.Serialization.DataMemberAttribute(Order=1)]</code>, an attribute added to all the properties (getters and setters).</p> <p>Was this code removed because of the new Boolean value? How can i get back the serialization-support code?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload