.NET Framework - CLR Shared Memory, C# DLL load
Asked By DR
29-Oct-07 03:28 PM
CLR Shared Memory, C# DLL load
How to share memory between CLR calls to the same C# dll? Is there some way
to know in the C# dll when the dll is loaded? Is the dll reloaded each tiem
a method is called from SQL Server or is the DLL loaded once when the C# dll
is added to sql server with CREATE ASSEMBLY?
I wold like to be able to share memory accross calls to methods on the same
C# dll is why. e.g. a Shared ArrayList or a shared Hashtable.
SQL Server
(1)
ArrayList
(1)
Application
(1)
Hashtable
(1)
DR
(1)
Gettin
(1)
Doman
(1)
Tiem
(1)
Nicholas Paldino [.NET/C# MVP] replied...
DR,
Are you doing this in the same app domain? If so, then a static member
is all you need.
However, if you want to do this in different application domains, then
you can't use shared memory from C# (I think there is a way to do it in C++
with the CLI extensions, but I'm not sure). Rather, you would have to
create a service (not a literal one, but one instance which other app
domains communicate with) which will host the values and return them to the
callers.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
Willy Denoyette [MVP] replied...
I'm not clear on what you mean with shared memory, are you talking about
memory mapped files, or something else?. I'm also not clear on what you are
trying to achieve here.
To answer the remainder of your question, whenever you call into a managed
function or SP for the first time, the host (SQL Server) loads the CLR which
at his turn creates an Application Domain (AD) and loads your registered
assembly into that AD. The CLR keeps this AD loaded, and with it, the loaded
assemblies, until something really bad happens or until the DB is taken
off-line. The SQL/CLR can reload the AD whenever something bad happens in
your code, but otherwise the assemblies stay loaded until the server stops
or until the DB gets detached. That means that once you have called into a
function/sp your (Jitted) code remains loaded in the SQL Server process
space.
Willy.
DR replied...
http://rafb.net/p/vtxwnj70.html
see that post, it seems to return 1 each tiem as if the app doman keeps
gettin reloaded each time i call the clr sp
SQL Server and .NET Interview questions free download .NET Framework You can get full downloads for all real interview questions from www.questpond.com Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of it. http: / / www.questpond.com / InterviewRatingSheet.zip 2000 Interview questions of .NET , JAVA and SQL Server Interview questions (worth downloading it) http: / / www.questpond.com / InterviewQuestions.zip Core Java and OOP www.questpond.com / AddressbookProject.zip Web services Interview questions http: / / www.questpond.com / WebServicesAndRemoting.zip SQL Server 2005 Database optimization Interview questions http: / / www.questpond.com / DatabaseOptimization.zip SQL Server 2005 DTS
values (can be in thousands) from an xml file, and eventually write them all the SQL Server database. I was thinking we could first write all the values from xml to some datastructure (arraylist etc.) and then write from that datastructure to the DB with a single database call be the best possible datastructure to achieve this? Any pointers / suggestions are appreciated. C# Discussions SQL Server 2005 (1) SQL Server (1) SqlDataAdapter (1) SqlBulkCopy (1) IDataReader (1) Publish (1) ReadXml (1) GetXml (1) Gary, I would let SQL Server do it. You can pass the XML to a stored procedure and use the
search sql server by udp and list servers and respective databases in listboxes .NET Framework Hi! I am trying to populate the server list in a listbox as soon as the user opens the application and then depending which server he / she selected the databases within that selected server. I am not sure how can I achieve that. . .I have the code posted below lot for your help!!! Tammy Imports System.Net Imports System.Net.Sockets Imports System.Data.Sql Imports System.Data.SqlClient Imports System.Collections.Generic.List(Of WindowsApplication3.Form1) Imports System.Collections str2 = Nothing End If i = (i + 1) Loop End Sub Public Shared Function FindDatabases(ByVal server As String) As String() Dim connectionString As String = (TrustedConnection(server, Dim connection As SqlConnection = Nothing Dim command As SqlCommand = Nothing Dim reader As SqlDataReader = Nothing
Session management on web farm with sql server .NET Framework We have a website that works fine when hosted on a single server, however it experiences some strange problems when run on a web farm using SQL Server to handle session state. When running on the farm, in the same method call an that this is the problem. They are saying that because of the serialization / deserialization in sql server, the reference to the inner objects isn't flowing through to the object being stored in SQL Server. Does this sound correct? Should there be any differance between how a website code
Importing Data .NET Framework I'm new to SQL stuff. All I have is MS SQL Express that came with Visual Studio 2005, and SQL Server Management Studio Express, which I downloaded and installed. I've created a new table, and into the table? Thanks. - - Jonathan Wood SoftCircuits Programming http: / / www.softcircuits.com ADO.NET Discussions SQL Server 2005 (1) SQL Express (1) SQL Server (1) Visual Studio 2005 (1) SqlBulkCopy (1) Oracle (1) ADO.NET (1) FillSchema (1