473,413 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

C# and COM+ Constuct

All,

I am trying to use the COM+ constructor string as follows:

[ConstructionEnabled (true)]
public sealed class xxxx: ServicedComponent
{

public override void Construct(string constructString)
{

}
{

But when I build the project I get the following error:

C:\xxx.cs(33): xxxxxx.Construct(string)': cannot change access modifiers
when overriding 'protected' inherited member
'System.EnterpriseServices.ServicedComponent.Const ruct(string)'

What am I doing wrong?

Thanks
Msuk

Nov 16 '05 #1
4 3212
The 'Construct' method is defined as 'protected' in the ServicedComponent
class you can't change the access modifier in your derived class - this is
what the compiler error says...

You can't call this method externally from the class....

HTH

Ollie Riches

"msuk" <ms**@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
All,

I am trying to use the COM+ constructor string as follows:

[ConstructionEnabled (true)]
public sealed class xxxx: ServicedComponent
{

public override void Construct(string constructString)
{

}
{

But when I build the project I get the following error:

C:\xxx.cs(33): xxxxxx.Construct(string)': cannot change access modifiers
when overriding 'protected' inherited member
'System.EnterpriseServices.ServicedComponent.Const ruct(string)'

What am I doing wrong?

Thanks
Msuk

Nov 16 '05 #2
Hi,

All the examples show that you can have it as a public method e.g

http://www.ondotnet.com/pub/a/dotnet...t_ch10/?page=6

What should it be?

Thanks
Msuk

"Ollie Riches" wrote:
The 'Construct' method is defined as 'protected' in the ServicedComponent
class you can't change the access modifier in your derived class - this is
what the compiler error says...

You can't call this method externally from the class....

HTH

Ollie Riches

"msuk" <ms**@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
All,

I am trying to use the COM+ constructor string as follows:

[ConstructionEnabled (true)]
public sealed class xxxx: ServicedComponent
{

public override void Construct(string constructString)
{

}
{

But when I build the project I get the following error:

C:\xxx.cs(33): xxxxxx.Construct(string)': cannot change access modifiers
when overriding 'protected' inherited member
'System.EnterpriseServices.ServicedComponent.Const ruct(string)'

What am I doing wrong?

Thanks
Msuk


Nov 16 '05 #3
IIRC IObjectConstruct (the COM+ construction interface) has the signature

IObjectConstruct
{
HRESULT Construct(IDispatch* pCtorObj);
}

This is obviously not the same signature as the overridable Construct method from ServiceComponent. So ServicedComponent implements the interface and then it's implementation of IObjectConstruct::Construct calls a protected virtual Construct method which you can override. Thats why the Construct method you override is protected rather than public

Regards]

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

The 'Construct' method is defined as 'protected' in the ServicedComponent
class you can't change the access modifier in your derived class - this is
what the compiler error says...

You can't call this method externally from the class....

HTH

Ollie Riches

"msuk" <ms**@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
All,

I am trying to use the COM+ constructor string as follows:

[ConstructionEnabled (true)]
public sealed class xxxx: ServicedComponent
{

public override void Construct(string constructString)
{

}
{

But when I build the project I get the following error:

C:\xxx.cs(33): xxxxxx.Construct(string)': cannot change access modifiers
when overriding 'protected' inherited member
'System.EnterpriseServices.ServicedComponent.Const ruct(string)'

What am I doing wrong?

Thanks
Msuk


Nov 16 '05 #4
You can't change the access modifier (he, but that's what the compiler
say's..;-).

Change your method definition to:

protected override void Construct(string s) {
..

}

And don't forget that passing a string is done through the
ConstructionEnabledAttribute.

[ConstructionEnabled(Enabled=true, Default="Test string")]
Willy.

"msuk" <ms**@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
All,

I am trying to use the COM+ constructor string as follows:

[ConstructionEnabled (true)]
public sealed class xxxx: ServicedComponent
{

public override void Construct(string constructString)
{

}
{

But when I build the project I get the following error:

C:\xxx.cs(33): xxxxxx.Construct(string)': cannot change access modifiers
when overriding 'protected' inherited member
'System.EnterpriseServices.ServicedComponent.Const ruct(string)'

What am I doing wrong?

Thanks
Msuk

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andy Howells | last post by:
Can anybody help me on this? I am getting the below error but have not got a clue why. The file in my classpath eing used has the class that it says is not defined. Any ideas? I am running java...
0
by: Randy Roman | last post by:
Hello to all. I have a nagging problem concerning where to call CoUninitialize() COM function. I realize that this may be more of a C++/COM question rather than a Java question, but I just thought...
3
by: Mikko Ohtamaa | last post by:
Hi, I am quite new to Python, PythonCom and COM generally. As a former Java programmer, I have found Python's flexible ability to access native Win32, especially COM, very comfortable. However,...
1
by: Noah | last post by:
Hi, How do I shutdown a win32 COM server? I am scripting Adobe Illustrator through its COM interface. The problem is that Illustrator has memory leaks. And after a few hours of running,...
0
by: Brent Turner | last post by:
Under python 2.2 I was able to create a COM object in an exe much of the same way that I could from py source... meaning that I was able to register the com server and create an instance using...
5
by: Andre Bernemann | last post by:
Hi, I have written a Python COM Server with the help of Mark Hammond's Book Programming Python on Win32. I used the CreateObjects method in VB to access the COM Methods and all worked fine....
2
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
4
by: Ishpeck | last post by:
I need to make IE execute javascript in a web page with COM+ and Python. Similarly to the way they do it in this article. . . http://www.codeproject.com/com/jscalls.asp
1
by: Gijs Korremans | last post by:
> Does IPADDRESSSTRUCT appear anywhere in the makepy-generated module ? Specifically, there should be a RecordMap dict containing any defined Records and their GUID's. No it's not in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.