WCF / ASMX :: Instantiate An Instance Of An Entity (that Has A Datacontract On The Server Side)?

Oct 13, 2010

On the client I want to instantiate an instance of an entity (that has a datacontract on the server side), send it to the server, let the server modify it in some way, and send it back. I'm talking about using standard-issue, ordinary WCF objects with DataContract/DataMember attributes.

The only way I could figure out to accomplish the above is to pass the object by reference. Is there another way?

In researching this, I found the links below, one of which says it is not possible to pass by ref (yes I realize we are passing a copy, but it is the result I'm interested in. Perhaps that is what the author is alluding to??).

Sorry for having to ask this but I'm confused (again).

http://stackoverflow.com/questions/1956039/by-ref-arguments-in-wcf-bad-or-good
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8d7c424d-af31-442d-94d3-119f371300e5
http://msdn.microsoft.com/en-us/library/ms733070.aspx

Server code:

[Code]....

Client code:

[Code]....

View 2 Replies


Similar Messages:

C# - Manually Instantiate Controller Instance From Arbitrary URL?

Jan 14, 2010

My skills are failing me, and I know I've seen the code around for this but I can't find it. What's the quickest way to take any arbitrary URL, run it through your asp.net mvc routing system, and come out with a reference to a controller instance on the other end?For example, code execution is inside some arbitrary controller method. I want to do something like this:

...
string myURL = "[URL]";
RouteData fakeRouteData = new RouteData(Route???, IRouteHandler???)
RequestContext ctxt = new RequestContext(this.ControllerContext.HttpContext,
fakeRouteData);
ControllerFactory factory = ControllerBuilder.Current.GetControllerFactory();
Controller result = factory.CreateController(ctxt, controllername???)

I'm trying to get an instance of a controller just like the routing system does, regardless of where the code is executing. I'm unclear as to how to fit the pieces together at this point.

View 3 Replies

WCF / ASMX :: Instantiate A Web Service?

Jul 7, 2010

I referenced(Web Reference) a web service on my PC for my Asp.net project in Visual Studio 2005. The name of my web service is "Condotti". How do I instantiate/consume it? The compiler does not recognize it if I try and do something like this:Condotti = new Condotti(); // Compiler error?

View 1 Replies

/ ASMX :: WCF - ExtensionData And Generic List In DataContract?

Apr 5, 2010

I am constructing a wcf service, shares a data contract to client. Now, I am facing two issues.

1. The serialized Generic List data member, is having duplicate elements, specially a parent element with xml element name as data member name and child elements(since collection) with same name.

eg. if my data member in data contract is List<abc> then, the output is <abc><abc></abc><abc></abc></abc>. But expected is juts <abc></abc><abc></abc><abc></abc>... I tried adding xml element name attribute to data member. but didn't succeed.

2. ExtensionData xml element is present in the serialized response data contract even though my datacontract in not implementing the IExtensibleDataObject.

View 1 Replies

WCF / ASMX :: Referring Multiple DataContract DLLs In One Component?

Oct 14, 2010

I am creating few WCF services. The number may be high. And we have used a pattern in each service to handle different targets. Now the issue is like each service is having 3 classes. And these three classes are similar in all sevrices with minor changes. These classes use corresponding data contracts in thier classes and the remaing logic is same. Now i am trying to reduce no of classes in each service. So I've added a class librray to solution and these classes are available in that library. And I am referring these library in each service. Since all services use this library, I am referring all data contracts in this newly created library.

My question is what is the impact of referring a dll(s) in class library. Is it ok to refer all dlls in one library and refer that library in each service? Earlier implementation is referring corresponding data contract dll in each service. Now all the data contracts are removed from services and moved to one library. Am I doing correct in terms of performance and maintainability?

View 3 Replies

WCF / ASMX :: Client DataContract Has Empty/null Values From Service?

Mar 26, 2010

I have a simple WCF service that returns the time from the server. I've confirmed that data is being sent by checking with Fiddler. Here's the result object xml that my service sends according to fiddler.

[Code]....

Literally the only difference is the namespaces within the application. But still the values being returned are null, empty or a .NET default.

View 1 Replies

Cannot Create An Instance Of A COM Component On A Server Side

Jul 20, 2010

I'm trying to use MS IME on a server to retrieve some Japanese info in a silverlight app. The app accesses to the server by using WCF, but when calling a CoCreateInstance to create a IFELanguage2, it gives me -2147467262. The same code I'm using on the server actually works pretty fine on a WPF app.

Here is the code,

// ...omit
Guid imeGuid;
int errCode = Ole32.CLSIDFromString("MSIME.Japan", out imeGuid);
WinBase.CheckError(errCode);
Guid feLangIID = new Guid(Constants.IID_IFELanguage2);
IntPtr ppv;
errCode = Ole32.CoCreateInstance(imeGuid, IntPtr.Zero, Ole32.CLSCTX.CLSCTX_ALL, feLangIID, out ppv);
WinBase.CheckError(errCode); // errCode is 2147467262
IFELanguage IfeLanguage = Marshal.GetTypedObjectForIUnknown(ppv, typeof(IFELanguage)) as IFELanguage;
errCode = IfeLanguage.Open();
WinBase.CheckError(errCode);
// ...omit

Do I need to setup anything to use the MS IME on a server side? I'm running the app on the following environment, IIS7 .NET Framework 4.0 Windows 7 pro 64 bit VS2010

View 1 Replies

How To Set A Server Side Parameter On Entity Data Source

Oct 6, 2010

I have a gridview which I databind to EntityModel

This typically looks like

something a
something b
companyID

on Login I get and set the compnay which has the ID so what in essence I want to do is on databind set the Where clause of data source to what the server side paramter for company ID is.

View 1 Replies

WCF / ASMX :: Converting BusinessEntity List To Datacontract List?

Jan 28, 2011

I have a wcf service.In many places I am converting business entity list to datacontract list.

So I am trying to write a generalised method.

I have acheived to convert business entities with out list.

But when we give a list of business entity,it is getting failed.

to convert list of Business Entity to List of Datacontracts.

View 5 Replies

WCF / ASMX :: Accessing Streaming Photos Server Side?

Jan 4, 2011

The more I think about it, the more confused I get. Is this even an ASP.NET question? Maybe it's a Silverlight question, or maybe it's an IIS question. Maybe it's a C/C++ question?!

I rent a server from a server farm. I also subscribe to a security service that streams, over the Internet, once every three seconds, via https, a series of JPG photos from four outdoor security cameras at a certain location.

I want to collect these photos on my rented server (server side). Keep in mind these are photos, not video, though after two weeks of streaming you can get around 50 GB of photos I am told, so I'll have to track storage consumed and delete the old ones, but that's a minor issue.

I researched how to capture streaming photos in ASP.NET and found nothing. I researched it in Silverlight and found a number of links for client side video chatting (a new feature supported by Silverlight 4) both multi-user and single-user, assuming they have web-cams attached to their client side PC. Not quite the same problem as what I have, since I don't care to attach any process to the four security cameras (the security company already wrote the software to do that, and is streaming it live). I just want to know how I can capture and store the streamed photos on my server.

View 1 Replies

WCF / ASMX :: Server Was Unable To Process Request / Object Reference Not Set To An Instance Of An Object?

Apr 16, 2010

I have a webservice, it has few webmethods. when i create a client proxy and invoke the methods to check its response, i am getting this error. Can someone tell me what things can i check to know the cause of this? The error is not saying much hence blocked on this.

View 1 Replies

Generate Entity Framework Model From Client Side?

Feb 27, 2010

Can I generate entity framework model by clicking button in browser in client-side and save it back to web server PC?

View 2 Replies

WCF / ASMX :: Electronic Store - Two Separate Projects For Entity?

Aug 11, 2010

Nowadays I'm building an electronic store where I work. We have a few other online applications for the e-marketing and e-commerce activities, such as payment forms of campaigns we're spending, various portals etc. There is a common entity in our sites : VISITOR. We save a record for each visitor containing various information. Also, we have another entity - PURCHASE - the purchase of a product. It also exists in some of our DBs, Depending on applications. Today, when I'm designing a new store I decided to get WCF into business.

The purpose is to union all the application workings with PURCHASE and VISITOR. Since there are several applications that use the entity VISITOR and PURCHASE, I thought to develop VISITOR WCF and WCF for PURCHASE. I thought to create them in two separate projects - each one on its own WCF SERVICE APPLICATION, and to invoke them from my new shop as a beginning and in the future from the other applications. Both WCFs will work on the same DB that will contain and work with VISITOR and PURCHASES.

View 9 Replies

WCF / ASMX :: Write Method Which Will Return From Data Entity

Jun 11, 2010

What i need to do: When i click button on my .aspx page WCF service should be called, which should return data from ADO.NET entity data model. Entity data model and webservice is already added. I just have to write a method which will return data from data entity.

View 2 Replies

Server Side - Themes Won't Work When Using Server Side Tags

Apr 8, 2010

The code for the asp.net page is:

<div class="facebox_content">
<% if (CurrentUser.Role == "Free")
{
%>
<table cellpadding="0" cellspacing="0" style="border-collapse:collapse;width:380px;">
<tr>
<td>

User Name :

</td>
<td>

Membership Cost :

</td>
</tr>
<tr>
<td style="width:190px;">
<asp:TextBox ID="txtUserName" Enabled="false" runat="server" Text="<%= CurrentUser.Name %>"/>
</td>
<td style="width:190px;">
<asp:TextBox ID="txtCost" Enabled="false" runat="server" Text="2000"/>
</td>.........

View 1 Replies

Web Forms :: Best Way To Instantiate HtmlGenericControl To Create A DIV Tag?

Jun 21, 2010

I'm building a web app that assembles output on the fly, and I'm trying to find the right way to instantiate HtmlGenericControl to create a DIV tag. By default, instantiating creates a SPAN tag. Anyone know how to use it so it creates a DIV?

View 2 Replies

Web Forms :: Can't Instantiate A Master Page From A Control

Jan 15, 2010

My project has the following structure:

- myProj
- shared [folder]
- controls [folder]
- videolist.ascx [user control]
-iphone_Shared_Controls_VideoList.cs (had to change the codebehind name)
- masterpages[folder]
- master.master [master page]
- Shared_MasterPages_MasterPage

I am inside the codebehind of videolist.aspx and I can not instantiate a copy of the masterpage. Ive noticed that there are no namespaces around the masterpage or the control is this normal? It is a website project. I am used to working on compiled web applications .net 1.1 style.

For the record I was able to 'see' the master page from .aspx pages but not from these controls. I cant getit through intellisense or even if I hard code and compile I get errors.

View 1 Replies

MVC :: Instantiate HtmlHelper Object In Controller Action?

Jun 10, 2010

Is it possible to instantiate an HtmlHelper object in a controller action in order to call HtmlHelper.EditorFor?

I would like to call HtmlHelper.EditorFor to return some partial html generated by an editor template in response to an ajax call. If I can do so I would not need to create an ascx file that otherwise would do the call to EditorFor.

View 2 Replies

Object Data Type Serialization In Wcf Using DataContract Attribute

Mar 21, 2011

I have created a WCF Rest API Service using wcf rest starter kit preview 2 which automatically return JSON or XML data depending on the requested content type. everything is working fine but as my service methods return multiple data type some methods returns a object of a class or collection of class, bool, int or collection type. so I planed to return a same Response in all methods for this I Create a new class as following:

[DataContract(Namespace = "")]
public class ServiceResponse
{
[DataMember]
public bool IsError
{ get; set; }
[DataMember]
public string ResponseMessage
{ get; set; }
[DataMember]
public Object ResponseData
{ get; set; }
}

and User class as following:

[DataContract(Namespace = "")]
public class User
{
[DataMember]
public string UserName
{ get; set; }
[DataMember]
public int UserID
{ get; set; }
}

In ServiceResponse Class I have declared an Object Type property ResponseData and my all method has return type of ServiceResponse. My problem is that when I set any string,bool,int type as ResponseData it is serialized but when I set collection type or an object of another class which also has DataContarct attribute this class is not serialized see below code :

public ServiceResponse GetUser(int userID)
{
User user = getUser(userID); get user data from database
ServiceResponse response=new ServiceResponse();
var response = new ServiceResponse
{
IsError = false,
ResponseMessage = string.Empty,
ResponseData = user; // Setting Result Data here
};
return response;
}

when I called above method(GetUser) I got Null response due to serialization problem, but following code works fine

public ServiceResponse TestMethod(string testMessage)
{
ServiceResponse response=new ServiceResponse();
var response = new ServiceResponse
{
IsError = false,
ResponseMessage = string.Empty,
ResponseData = testMessage; // Setting Result Data here
};
return response;
}

View 1 Replies

DataContract IsReference=true Returning Empty Objects?

Apr 1, 2011

I have a WCF service with cyclic references that I was using the CyclicReferencesAwareAttribute attribute (http://chabster.blogspot.com/2008/02/wcf-cyclic-references-support.html) to solve. However now I want to use the same service with a Silverlight client. Receiving data works well on the Silverlight client with this method, however the CyclicReferencesAwareAttribute attribute does not work on the Silverlight side when I want to send objects back again.

I have changed to use the IsReference property on the data contract which is supposed to get round with this issue. However now the objects that are returned are empty! (All fields are either default or null). This is the same in my ASP.NET client (original) and my Silverlight client.

Has anyone hit is issue before? Here is the attribute [System.Runtime.Serialization.DataContract(Namespace="http://testnamespace.co.uk/entities", IsReference=true)]

View 1 Replies

Web Forms :: Accessing Non-Static Method From Another Class Without Instantiate

Apr 27, 2016

I have a class and call class A method by creating class A object

unlike this call Class B method by using class B object 

Code is here below

class A {
public void A1() {
Console.WriteLine("I am from Class A");
}
}
class B {
public void B1() {
Console.WriteLine("I am from Class B");

[Code] .....

View 1 Replies

Web Forms :: How Do You Write To A Client-side Control (text Box) With Server-side Code

Jan 6, 2010

If I have a standard HTML textbox

[Code]....

but got a readonly error.

View 10 Replies

Access Server Side Variable On Client Side And Vice Versa And JavaScript?

Dec 9, 2010

I have a requirement of adding server side variables in client side and other way round. Because I need to set a value from client side using javascript and access the same in code behind page.

I have to use C#.Net and JavaScript.

View 2 Replies

Jquery - Options For Page With Matching Client-side And Server-side Markup?

Oct 17, 2010

Suppose I'm building a StackOverflow clone using webforms ASP.NET and jQuery. The Question page has a question, several answers, and comments under each. Requirements:Users can post new answers and comments, and edit existing ones, without postbacks. No UpdatePanels; the AJAX calls retrieve just the JSON they need, not HTML fragments. The page loads with all existing answers and comments in place (no javascript needs to run to read the page).

What I'm trying to figure out is how to do this without having to maintain two sets of markup (one that's bound on the client using some form of jQuery templating, and one that's bound on the server using traditional WebForms).

View 7 Replies

Ajax - Listbox Items Client Side Reordering Not Reflected In Server Side?

Jan 5, 2010

I reordered some items in a listbox using Javascript. When I read the items in a postback in the code behind (ASP.NET), the order is in the original order. How do I get the same order as shown in the screen after Javascript manipulation?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved