473,320 Members | 1,572 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,320 software developers and data experts.

Exposing selected parts of C# Assemblies

J L
I'm trying to expose only a limited set of method calls from a C#
program to someone using my dll.

The entire application is written in C# and my first attempt has been to
try and write a COM object/interface.
However, since the COM object references parts I don't want exposed, in
order to use the DLLs in a new C# project the other .dlls must be added
as references.
Is there any way to prevent the methods in these other DLLs from being
seen by another developer (in other words, forcing them to only use the
methods in the "API DLL")?

Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
7 1699
VJ
Just curious why can't you declare the method & properties as private?, or
did I miss something in your question?

VJ

"J L" <jl******@gmail.com> wrote in message
news:eI**************@TK2MSFTNGP10.phx.gbl...
I'm trying to expose only a limited set of method calls from a C#
program to someone using my dll.

The entire application is written in C# and my first attempt has been to
try and write a COM object/interface.
However, since the COM object references parts I don't want exposed, in
order to use the DLLs in a new C# project the other .dlls must be added
as references.
Is there any way to prevent the methods in these other DLLs from being
seen by another developer (in other words, forcing them to only use the
methods in the "API DLL")?

Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2
Your question is not clear. Exposing "... method calls from a C# program"
sounds like using a running program being used as a server in some way. But
then you say "...to someone using my dll". Which sounds like you want to
allow others to use routines in a DLL that your application uses.

If you simply want to allow another program to call certain library routines
in a DLL that's part of your application, you can control the visibility of
any method, property or field using private, protected, internal or public
declarations as desired.

--Bob

"J L" <jl******@gmail.com> wrote in message
news:eI**************@TK2MSFTNGP10.phx.gbl...
I'm trying to expose only a limited set of method calls from a C#
program to someone using my dll.

The entire application is written in C# and my first attempt has been to
try and write a COM object/interface.
However, since the COM object references parts I don't want exposed, in
order to use the DLLs in a new C# project the other .dlls must be added
as references.
Is there any way to prevent the methods in these other DLLs from being
seen by another developer (in other words, forcing them to only use the
methods in the "API DLL")?

Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #3
J L
I will clarify, but I think I've figured out some things.

I have an application that is made up of a set of assemblies.
Unfortunately as things are structured, classes in one assembly need to
see others in other assemblies.

I'm trying to create another assembly that is an "API Assembly" that
will expose certain parts to a programmer.
I only want an outside programmer to be able to use this assembly to
extend the application.

The problem I'm having is that I want one of the classes in this
assembly to inherit from a type in one of the assemblies I want to hide.
It seems that this is not possible, because once I inherit, VS.NET
forces you to reference the other assembly if you were to reference the
API assembly (i.e. I have something like this:

class APIClass : InternalClass
{
...
}

where InternalClass is defined in another assembly.
Is there any way I can prevent a programmer from seeing that
class/assembly?

I realize that its probably not a good idea to inherit from a class I'm
trying to hide, so any suggestions on better methodologies would be
appreciated too.
I'm sort of a C# newbie (done mostly C/C++ in the past)

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #4
VJ
I think you are looking to write a SDK of sort for your application if I am
correct? Let me know

VJ

"J L" <jl******@gmail.com> wrote in message
news:ub**************@TK2MSFTNGP10.phx.gbl...
I will clarify, but I think I've figured out some things.

I have an application that is made up of a set of assemblies.
Unfortunately as things are structured, classes in one assembly need to
see others in other assemblies.

I'm trying to create another assembly that is an "API Assembly" that
will expose certain parts to a programmer.
I only want an outside programmer to be able to use this assembly to
extend the application.

The problem I'm having is that I want one of the classes in this
assembly to inherit from a type in one of the assemblies I want to hide.
It seems that this is not possible, because once I inherit, VS.NET
forces you to reference the other assembly if you were to reference the
API assembly (i.e. I have something like this:

class APIClass : InternalClass
{
..
}

where InternalClass is defined in another assembly.
Is there any way I can prevent a programmer from seeing that
class/assembly?

I realize that its probably not a good idea to inherit from a class I'm
trying to hide, so any suggestions on better methodologies would be
appreciated too.
I'm sort of a C# newbie (done mostly C/C++ in the past)

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #5
J L
Yes, you are correct in that I'm trying to write an SDK.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #6
VJ
umm... its really a challenge, not that simple techinquies..., you have to
go through a design phase.. & provide phased implementation of interfaces &
abstract classes.., not much different from what you would do in C/C++..
expect there is some syntax variations..., don't think C# provides anything
new or a shortcut for SDK development. From your situation point, looks like
you might have to do some re-writing or restructure of classes & Yes you
don't inherit from classes you want to hide, speically if there are in
separate assemblies. One thing would be to have the code in the same
assembly, if you still have to inherit from a class you want to hide.

You may also want to look at securities concept
(http://msdn.microsoft.com/library/de...l/THCMCh07.asp)
in .NET, it provides a way sheilding copy protection or usage of assemblies.
That is pretty length one,... but helps a lot, we started from there & can
say have some amount of structure & a very good protection to our code.

HTH
VJ
"J L" <jl******@gmail.com> wrote in message
news:ub**************@TK2MSFTNGP12.phx.gbl...
Yes, you are correct in that I'm trying to write an SDK.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #7
J L wrote:
I have an application that is made up of a set of assemblies.
Unfortunately as things are structured, classes in one assembly need to
see others in other assemblies.

I'm trying to create another assembly that is an "API Assembly" that
will expose certain parts to a programmer.
I only want an outside programmer to be able to use this assembly to
extend the application.


You say "a set of assemblies" but my guess would be that you mean a
set of .dll files, with each library file constituting one assembly.

I'm not sure - because I haven't done this - but you should be able to
bundle all these library files into a multi-file assembly. Then, you
could use "internal" access for cross-library inheritance &c, and
"public" access for third-party access.

--

www.midnightbeach.com
Nov 16 '05 #8

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

Similar topics

0
by: Rashad Rivera | last post by:
Hay gang, I know how to create assemblies with JScript, C# and VB that work in DHTML, dispite what others have told me, but when I look at the object in Debug time from the DHTML script, I do...
5
by: mmkhajah | last post by:
Hi, I am trying to have a set of base classes and interfaces of an application framework in their own assembly. That way, concrete implementations of the API will reference that assembly and...
4
by: =?Utf-8?B?QkogU2FmZGll?= | last post by:
We have a class that has a public property that is of type List<T>. FXCop generates a DoNotExposeGenericLists error, indicating "System.Collections.Generic.List<Tis a generic collection designed...
5
by: Mark Olbert | last post by:
I just noticed something weird about the calendar control in ASPNET2. If you assign a value to SelectedDate that has a time component (e.g., 3/1/2007 10:37 AM), and you have a custom style for the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.