|
Your colleague just need to reference your application (DLL). He will be able to use any public members of your library like a C# application would. After compiling an application, doesn't matter if it was written in C# or VB.NET, you use it the same way.
Regards,
Leonardo Muzzi
|
|
|
|
|
Leonardo Muzzi wrote: He will be able to use any public members of your library
How do he references to it ...... i.e just using the form name?? or how ??
Thank you
|
|
|
|
|
First you build an assembly with your C# library. Then send this assembly (DLL) to him, and he can reference this assembly in his own application. If he is using VS, just right click the project and "Add Reference". After adding the reference, his application will be able to see all your Namespaces and all public classes within it.
If you are making a windows form app, you should separate the Executable from the Business library that you want to share. Let's say you have a method called "ListClients" in a "Clients" class and wants to share it. You should build a separate project, a Class Library project, called "ClientsAccess" for instance, and put this class in this new project. Then, you reference this project from your windows form app. This new Class Library project will generate a DLL, called "ClientsAccess.dll", that you can send to your colleague so he can reference the DLL just like you did and use the Clients class inside.
Regards,
Leonardo Muzzi
|
|
|
|
|
OK DUDE.... I will try it the rest by my self... thnks for the help
|
|
|
|
|
Hey dude....we have all tried to help you here....however, it is clear that you would benefit from reading a couple of books....or taking some .net and development classes before asking more. The questions you are asking are very basic....and....would be covered in these resources....If you continue to rely on others you will never learn or succeed in this profession.
only two letters away from being an asset
|
|
|
|
|
ya you are right ....... i will follow your advice ..... by the way are there any free books on .Net & c# windows form applications online??
thank you
|
|
|
|
|
Hi,
Someone can point me to an article that explain how to read traffic/data from cisco router device.
Thanks
|
|
|
|
|
Hey dude .... I am not here to answer you question but to ask you something similar to urs .....
What things must should I have to know inorder to work on socket programming .... I just wanted to work on VOIP....
Thank you...
|
|
|
|
|
|
|
Hello,
i have a application, where parallel running threads have access to my database. In most cases, that's no problem, but if a thread has a open DataReader and another Thread wants to access the DB too i get a problem, because there's only one open DataReader allowed.
Now, i wanted to make a Method (lets call it "dbRead()" ) which asks the DB and returns the Data to the specific Thread or Method, which executes dbRead(). My problem is now, that this could become a bottleneck if i have a lot of Reader-Transactions.
There's the possibility to make a list of classes (lets call it "dbOperations") which contains public the dbRead(), put maybe 5 of them in a List<dboperations> and if i want to make a transaction i use randomly one of the classes and start "dbOperationsList[randomNr].dbRead()".
This would work, but isn't there maybe a tutorial or has somebody such an piece of code? Because i don't think, that i'm the first with this problem
Many thanks for your help
Patrick
|
|
|
|
|
My applications always seem to allow multiple readers to a database without issue.
|
|
|
|
|
Provided they each have their own connection?
|
|
|
|
|
Create more connections; one for each concurrent request.
|
|
|
|
|
OK,
that was my first problem and so that i need more Connections to the database, i'll need such an "RequestManager". I've made a simple piece of code and i'll test it if it works. It's very simple. A class, which a standardized Method which gives me a List<object[]> back (it's not a Object[][], because i don't now how much entries i'll get back i get only the amount of columns back), this method makes the request and reads the data and closes the DataReader. This class has a own connection to the database. So... i put n-instances in a List at the start of my application and make a simple integer-value, which gives me the index of the next RequestManager-Class back.
So the first request goes to List<requestmanager>[0], the second to List<requestmanager>[1] and so on... a simple and effective LoadBalancing and Transaction-Management for my Database. And if i see, that i need more connections, i could realize this if i only make more instances of the RequestManager Class.
Many thanks for your ideas.
|
|
|
|
|
Doesn't sounds like a good idea to me. I'd suggest you to use separate connection and command instances for each threads. ADO.NET has inbuilt connection pooling and you don't need to pool it manually.
|
|
|
|
|
N a v a n e e t h wrote: Doesn't sounds like a good idea to me.
Indeed.
N a v a n e e t h wrote: separate connection and command instances for each threads
Yes, but a thread may still need more than one connection to the same database.
N a v a n e e t h wrote: ADO.NET has inbuilt connection pooling
But I don't think it will detect when you need an additional connection to a database and create it. The pooling only pools the connections that have been created by the application. And of course, only if the connection has been closed. So the developer still has to do that.
N a v a n e e t h wrote: you don't need to pool it manually
Not pool, but create.
|
|
|
|
|
PIEBALDconsult wrote: The pooling only pools the connections that have been created by the application
My understanding is: each pool will have a minimum connection object limit and when a pool is initiated, these objects will be created and ready to use. When SqlConnection object is requested, it will be served from the pool if available.
PIEBALDconsult wrote: So the developer still has to do that.
Caching the connection objects? I still believe developer shouldn't cache the connection objects. All they can do is to wrap the connection in a using statement, so it gets disposed properly and return back to the pool. Let framework's pooling do it's job.
|
|
|
|
|
N a v a n e e t h wrote: these objects will be created and ready to use
With what settings? How will the pool know what the user wants to connect to until asked?
N a v a n e e t h wrote: When SqlConnection object is requested, it will be served from the pool if available.
If the connection string matches, yes.
N a v a n e e t h wrote: gets disposed properly and return back to the pool
I understand that happens at Close. So close the connection, but retain the Connection object. When you reopen the connection, the pool tries to use an existing connection.
http://msdn.microsoft.com/en-us/library/8xx3tyca(VS.85).aspx[^]
|
|
|
|
|
PIEBALDconsult wrote: With what settings? How will the pool know what the user wants to connect to until asked?
My bad, you are correct. Pool will be initiated only when a connection is first opened.
PIEBALDconsult wrote: I understand that happens at Close
You can call dispose as well. It happens at dispose too. Here is what MSDN says,
We strongly recommend that you always close the connection when you are finished using it so that the connection will be returned to the pool. You can do this using either the Close or Dispose methods of the Connection object, or by opening all connections inside a using statement in C#, or a Using statement in Visual Basic.
|
|
|
|
|
In one of my database access schemes I have a Dictionary<string,connection>, the first connection is named "" and is used by default, but when necessary I can use:
dbc.AddConnection ( "name" )
dbc [ "name" ].Execute...
dbc.RemoveConnection ( "name" )
So I can be reading with the default connection and use another to perform other actions as needed.
|
|
|
|
|
Well a lot of answers from you thanks =)
So to the question, "why doesn't get every thread a db-connection?", the answer is, that i make a server-application and for each user-connection i have on thread, but i don't have a huge amount of requests from each user, so it doesn't make sense to give each user a own db-connection, and the second is i don't know how many users will use the server.
So the idea with this RequestManager. I make maybe 5 or 10 (or how many i need) instances from it, stored in a List<requestmanager>. Each RequestManager has an own DB-Connection and handles the Reader for itself. If a user now makes a request, the class of the User-Connection starts the Method "GetData()" (give the baby a name ) from one of this RequestManagers. So i can make a few requests parallel and if i need more i can easily put even more RequestManager in this List<>.
How does my application get the information to put more RequestManager-instances into this list? Well that's easy, over a configuration-file. I let my application reload them every 5 minutes and it checks how many RequestManager i need and so i'm able to configure them while my system is running.
Your examples, had the nearly the same idea as mine. But i only handle with the "RequestManager" and not with Reader and Connections seperately. I can only make failures on one place (the RequestManager).
Thanks for your help, you gave me a lot of inspiration for this problem.
|
|
|
|
|
MARS (Multiple Active Result Set) can give you a quick solution in this respect (if you are using ADO.NET 2.0 and SQL Server 2005).
|
|
|
|
|
Thanks,
but i don't use SQL Server 2005, but i read the Article about MARS on MSDN, this is not exactly that, what i want, because i want the possibility to have more parallel running transactions.
But many thanks to you all for your answers, but i have now the solution (or at least the ideas for my solution)
|
|
|
|
|
Suppose I have a generic class A with a method Xyz.
public class A<t> : where T : class
{
// lots of stuff omitted...
public int Xyz()
{ // details omitted
}
}
Elsewhere I have an object reference. I want to test if the reference refers to an instance of A (don't care about what <t> is), and if it is an instance of A, invoke method Xyz and get the return value. Something like
if (ref is A)
{
int returnValue = ((A)ref).Xyz();
}
except that this code doesn't work when A is a generic type. Can this be done?
Thanks
Peter
|
|
|
|