|
-
Nov 19th, 2003, 02:59 PM
#1
Thread Starter
Fanatic Member
Remoting and Using Constructors with Parameters?
I am getting an error
"Can not run a non-default constructor when connecting to well-known objects"
when I try to create a new (remote) object in my client application. The new constructor accepts a couple of parameters, which apparently you can't do? If I change the new constructor to accept no parameters it works fine.
Is there anyway to have parameters in the constructor?? If not that that would really be inconvenient!
-
Nov 19th, 2003, 03:40 PM
#2
Well-Know are you using Client Activation? I think you can only use non default constructors if you use Client Activation. This would also require that the full source assembly be on the client computer not just an interface or what not.
-
Nov 19th, 2003, 04:21 PM
#3
Thread Starter
Fanatic Member
I am using Client-Activated objects, well-known mode=singlecall, as I don't have to worry about multithreading issues, and I also need my objects to maintain state. They are developed based on OO principles, and do not only serve to execute self contained methods that do not effect state.
I do have to include the entire dll in the client app which allows it to recognize by objects - but it only reads the interface, and I can change the dll on the server as long as the changes do not affect the interface that the clients are using (such as adding parameters to an existing public method that is being used by the client).
I am new to remoting, and I determined the above from what I could find and read, so please let me know if I am on the wrong track!
But I don't see why I can't have parameterized constructors. Without it, I would force UI developers to call an invoke method immediately after they create the empty object - and this leaves opportunity for failure.
-
Nov 19th, 2003, 11:09 PM
#4
Its been a little while since I've used remoting so I'm a bit rusty on the specifics. You could always go with a Factory model and have one class that provides instance of other classes. Then the factory class could be passed constructor info.
-
Nov 20th, 2003, 10:29 AM
#5
Thread Starter
Fanatic Member
I determined that I am actually using Server-activated objects, where the object is not created on the server until the first method call. This makes sense why you can't have anything but the default new().
So, now my question is, if I use Client-Activated objects, can I now use constructors with params?
-
Nov 20th, 2003, 11:17 AM
#6
Yes I just tested it with an old project. Although as I mentioned before if you use CAO then I believe the full object, not just the interface, must be in the shared assembly. I am a bit rusty and could be wrong but I believe that is one of the differences between CAO and SAO.
-
Nov 20th, 2003, 11:27 AM
#7
Thread Starter
Fanatic Member
Are you hosting on IIS? I have just read that:
"When creating IIS-hosted remote objects you cannot specify
constructor parameters; therefore it is not possible to use IIS to activate
CAO"
-
Nov 20th, 2003, 11:45 AM
#8
No I haven't yet tried IIS for hosting an Remoting. And the test was just an old example project I did for someone on this forum.
-
Nov 20th, 2003, 01:43 PM
#9
Thread Starter
Fanatic Member
There's alot to be learned through trial and error. Thanks for the assistance E!
-
Nov 20th, 2003, 01:44 PM
#10
Thread Starter
Fanatic Member
Oh, and that IconMenuExtender on your website rocks!!!
-
Nov 20th, 2003, 01:49 PM
#11
Thanks.
I like remoting but it seems that if you don't use it for a little while you foget a few steps (I do anyway). I wonder if it will change much in future versions of .NET, especially with the whole Indigo thing.
-
Nov 20th, 2003, 01:53 PM
#12
Thread Starter
Fanatic Member
I thought this was an interesting quote:
Web services that required 50,000 lines of code in Visual Studio .Net, or 27,000 lines of code in Microsoft's Web Services Enhancements (WSE) toolkit, will take only three lines of code in Indigo.
Guess we will have to wait and see
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|