Serialize EntitySet Through Net Remoting?
Jun 14, 2010
I have a shared object through net remoting. The problem is that this object has some EntitySet and EntityRef attributes. When I try to run the program I get an exception telling me that EntitySet is not marked as Serializable. If I mark it as Serializable everything seems to be ok, but when I try to access from outsied to the attribute represented by the EntitySet, I am not able to use it.
BTW, Does anyone know how change the default binary serialization of tcp channel?
View 3 Replies
Similar Messages:
Mar 12, 2010
what is the difference between .net 1.1 and .net 2.0 in terms of web services and remoting
View 5 Replies
Oct 26, 2010
First, let me explain a little bit about my setup. My server is setup as a Marshaled singleton object:
RemotingServices.Marshal(lsServer, ServerObject.objectUri);
In order to have two-way communication from the server to the client, the client activates a ServerObject, then passes in its own ClientObject (which is also a MarshalByRefObject) the server uses the ClientObject to talk back to the client:
var lsClient = new ClientObject();
var lsServer = (ServerObject)Activator.GetObject(typeof(ServerObject), url);
lsServer.attach(lsClient);
When the attach method is called, the server takes the ClientObject and stores it in a List:
public void attach(ClientObject client) {
clientList.Add(client);
}
The server can then call a method on the ClientObject called "SendMessage" to communicate to each client in its list:
foreach(var c in clientList) {
c.SendMessage("Hello");
}
This works great until a client is encountered that has disconnected. In this case, an error is thrown about the client refusing the connection. I can catch the error, but the problem is I cannot remove the reference to the ClientObject from the server's List. The following re-throws the "connection refused" exception anytime a client has been disconnected:
clientList.Remove(badClient);
So a couple of questions:
1- Is there a way to detect the connection state of a client without having to catch an error?
2- When I do detect a client that has disconnected, why does the attempt to remove the object from the server's list appear to "communicate" with the client (thus causing the exception to be thrown again?)
EDIT
As Patrick pointed out below, doing a Remove from a list causes the List to iterate my objects and do a comparison on them (calling .Equals) - this is what caused my ClientObject to attempt to communicate again and thus throw the exception. To resolve it, I instead changed the List to a dictionary keyed off a unique ID supplied by my Client at the time of attaching to the server. Then I used that unique ID to remove the client. I never did find a direct way for determining if a client had disconnected other than catching the error.
View 1 Replies
Sep 29, 2010
I have tables Events and Visitors with relation many-to-many. I had such error: Unable to update the EntitySet 'Events_has_Visitors' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.
I found similar problem at theWeblog of Ken Cox but it doesn't solve my problem. When I set primary key at Events_has_Visitors table and update Entity Model for some reason relation becomes 0..1 to *, but if I'll delete primary key - relation will become many-to-many again. But still doesn't work.
View 2 Replies
Feb 7, 2010
How would I create a type while knowing just the name of the type in string form example...
My aspx contains this and some bindable control
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=MyEntities" DefaultContainerName="MyEntities"
EntitySetName="MyData">
</asp:EntityDataSource>
Now from code I need to be able to create an instance of EntitySetName="MyData". Keep in mind I will not know these names until runtime tho. I can do EntityDataSource1.EntitySetName and this gives me the name in string form. But now I need to create and instance of it and get access to the members so I can manipulate the data. I have been trying Activator.CreateInstance and used various overloaded versions of it. Bottom line tho is I am not seeing how to do this. I keep running into trying to cast something into a type when all I have is the name of the type.
View 1 Replies
Mar 16, 2010
I'm building a Remoting Demo, and here's my scenario:
There are 4 projects:
ServicedCOM: This project I've built a ServicedComponent, this component using for access data from database.
RemoteLoader: I using this to load ServicedCOM to RemotingServer.
RemotingServer: This is an console application, and this application can be running from another computer.
WebApp: Client, this is inteface using for End User.
and my results: I can access and retrieve data with function is called SpeakHello (test function), but I cannot do the same thing to get sectors using this model, I think I'm doing something wrong. and here's my code snippet:
1. I have a ServicedCOM and a function to get Sectors is called GetSectors (I test OK)
[Code]....
[Code]....
2. I have a Remote loader
[Code]....
3. And here's RemotingServer
[Code]....
4. And the last is Client
[Code]....
View 2 Replies
Oct 28, 2010
Getting the following error and having trouble resolving it:
Unable to update the EntitySet 'ProfileSkill' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation. This is occurring when I try to save an entity... basic db structure is Profile table with a joining table ProfileSkill that connects to Skill. ProfileSkill has two foreign keys, one to each table it joins on, which together form a unique key for the table. The EF modeler displays this as a many to many relationship and obscures the ProfileSkill table.I remove the DefiningQuery section of the edmx files for ProfileSkill, so I did this:
[Code]....
That results in a different error:
Invalid object name 'SpaceModelStoreContainer.ProfileSkill'.
View 1 Replies
Sep 27, 2010
I've been having this problem since switching to MVC2. This isn't a new project, so not the usual wrong version type in the web.config file. Anyways, here is the scenario:
Two Tables:
[Code]....
I've created these two tables in a linq-2-sql class and I have a strongly typed view of projects. I can loop through the projects just fine, but I get an error when I try to loop through the tasks associated with the projects."foreach statement cannot operate on variables of type 'System.Data.Linq.EntitySet<Program.Models.Task>' because 'System.Data.Linq.EntitySet<Program.Models.Task>' does not contain a public definition for 'GetEnumerator'"
[Code]....
View 7 Replies
Jul 14, 2010
I'm so excited about the webmatrix, because it makes all the works to be easier than ever before, so I make a try, but I met a problem when I deployed the project membership db to remoting host (I chose the cytanium.com), and I had deployed the project files and another database sucessfully, only the membership related database failed, the error message is below:
[Code]....
I thought that the problem source is about the collation of the database, so I change my database collation from "Chinese_PRC_CI_AS" to "SQL_Latin1_General_CP1_CI_AS", but the problem is the same, I had search a lot of articles, but I didn't find a way to resolve this issue.
View 2 Replies
Jun 13, 2010
When using .net remoting, does the server limit incoming client remoting calls?
I find a particular remoting call (during ASP.NET page rendering) to take from 200ms to 1500ms. While the underlying data call is only 50ms. Factoring in remoting overhead of 150ms per call, the only difference between the two cases is that the latter scenario has about a dozen more parallel remoting calls in progress. So my guess is that when too many remoting calls are happening, some will get queued up? I also doubt system resource is the cause of the delay because it is not nearly saturated.
Searching MSDN, I find the below:
http://msdn.microsoft.com/en-us/library/ms973907.aspx
clientConnectionLimit: specifies how
many connections can be simultaneously
opened to a given server. The default
is 2. This is exactly the same as the
connection limit on ServicePoint in
the net classes.
That seems awfully low to me and if were the case, my app's performance would have been much worse. Can someone confirm if there is indeed a connection limit or some other throttling in .net remoting?
View 1 Replies
Apr 4, 2011
I've setup an ItemTeplate like so in a GridView:
<asp:TemplateField HeaderText="Building">
<ItemTemplate>
<asp:Label
[code]....
View 1 Replies
May 26, 2010
I created DBML file inside DLL. compiled it and added a reference to it into a website project.When try from webproject to use the DLL I get error.
[Code]....
View 2 Replies
Jan 25, 2010
Im using DataTable to write some XML. but i got Serialization problem. when i try write i got error message, your datatable is not serialize.(i dont want use DataSet)How i Serialize DataTable?
View 2 Replies
Mar 31, 2011
I'm trying to serialize a Request object for logging purposes. The code
System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(obj.GetType());
// obj is a Request object
gives me the following exception:To be XML serializable, types which inherit from ICollection must have an implementation of Add(System.String) at all levels of their inheritance hierarchy. System.Web.HttpValueCollection does not implement Add(System.String).
View 2 Replies
Mar 23, 2010
how we can serialize a datareader in webservices.
View 1 Replies
Mar 20, 2010
How to serialize the DataReader in webservices in asp.net?
View 4 Replies
Jun 21, 2010
I have no problem getting a custom profile class to work as it should in Asp.Net MVC 2, C# -- as long as I am content that the profile info is serialized as xml.The question is how to get it to serialize as Binary, rather than xml -- Is that possible?in the web.config...
<profile defaultProvider="MIProvider" inherits="Models.MbrProfile" automaticSaveEnabled="false">
<providers>
<clear />
<add name="MIProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="MIconnect" applicationName="myApp" />
[code]...
View 2 Replies
Feb 12, 2011
I am facing an critical problem in Enum serialization in WCF. Here is the scenario: I have an enum like this...
[Serializable] [DataContract(Namespace = "http://www.geniusdoc.portal.com/serivces/2011/v1/GdService", Name = "AppointmentMode")] public enum AppointmentMode : int { // 1: Email, 2: Phone [EnumMember(Value = "1")] None = 1, [EnumMember(Value = "2")] Email = 2, [EnumMember(Value = "3")] Phone = 3 }
Here I decorated each enum value with [EnumMember], so that I can use the Enum as Data Contract in WCF.
And, AppointmentMode will be saved as INTEGER in database. So I need to serialize this Enum to its value. So I have specified value to each member like... [EnumMember(Value = "1")]
Problems:
If I use the above code as it is...SvcUtil not considering Enum Text, and generating the Enum in Proxy as below...
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Name="AppointmentMode", Namespace="http://www.geniusdoc.portal.com/serivces/2011/v1/GdService")] public enum AppointmentMode: int { [System.Runtime.Serialization.EnumMemberAttribute(Value="1")] _1 = 1, [System.Runtime.Serialization.EnumMemberAttribute(Value="2")] _2 = 2, [System.Runtime.Serialization.EnumMemberAttribute(Value="3")] _3 = 3, }
If I remove the Value from [EnumMember(Value = "1")], while deserialization is considering Enum Text, and giving results as below
<AppointmentMode>None</AppointmentMode>
Expected result:
1. Enum in the Client proxy should be same original Enum.
2. Enum Deserialization should consider EnumValue, such a way that it will return
<AppointmentMode>1</AppointmentMode>
How to get this done?
View 5 Replies
Oct 13, 2010
Type 'System.Data.Linq.ChangeTracker+StandardChangeTracker' in Assembly 'System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable
have read all threads but still cant solve the error. I can do insert update and delete but dont know where exactly the error occurs and how??
View 1 Replies
Oct 21, 2010
i need to serialize and deserialize an image for my project. i have been googling it for a few days but i cannot find any VB codes related to image serialization... can someone give me some hints on how i should start?? for my program, i need to save the image to sql database and then i need to retrieve all the image for my product catalog
View 2 Replies
Jan 21, 2011
Currently I am working on SessionState with SQL. I have problem. I would like to serialize TreeNode. This TreeNode pbject will be assigned to Session and this is declare as below.
private _treeNode as TreeNode <-- member variable
how do I make this _treeNode seriablizable?
View 1 Replies
Jul 2, 2010
Is there any way or process to serialize the the objects?? i am trying to store the instance of few control in viewstate but it shows error msg that it is not a serialized object. should i perform some steps to serialize the objects ???
View 9 Replies
Feb 3, 2011
How do I get at the data after doing a .sortable serialize? Here is my code :
[Code]....
View 1 Replies
May 18, 2010
I am facing the problem while using For Xml'AddressLine' because it contains a character (0x000F) which is not allowed in XML I found some other similar charectors which is raising the exception.Using replace of such charectors results in loss of data Please give me a solution or any work around.
View 2 Replies
Feb 3, 2011
I'm learning ASP.NET MVC 2 I want to create a wizard-type application. I was reading you can accomplish this with the help of Html.Serialize method in ASP.NET MVC Futures assembly (To help preserve state as you step through views).
I haven't seen that this is even part of MVC 3.0 as well. how certain this feature will be included for sure in the future? I'm a little wary of relying on it being there.
View 2 Replies