I am using EntLib 4.1.
_db = DatabaseFactory.CreateDatabase("DbName");
DbCommand dbCommand = _db.GetStoredProcCommand("someProcedure");
_db.AddInParameter(dbCommand, "Id", DbType.Int32, id);
result = _db.ExecuteNonQuery(dbCommand);
After performing the task do I need to dispose the _db object, like:
finally
{
_db = null;
}
... ...
Hi Guys,
I need to perform deep cloning on my complex object model. What do you think is the best way to do that in .Net?
I thought about serializing / Deserializing
no need to mention that memberwiseClone is not good enough.
thanks a lot,
Adi Barda
...
In my code I need to set a process to connect it to a certain profiler. I understand that this is what I would have to do:
ProcessStartInfo processStartInfo = new ProcessStartInfo(exePath);
processStartInfo.EnvironmentVariables["Cor_Enable_Profiling"] = "0x1";
processStartInfo.EnvironmentVariables["COR_PROFILER"] = "{B146457E-9AED-4624-...
I have problems in converting the following code-snippet from C# to VB.Net:
if ((currentItem.Tag as FileSystemKind?) != FileSystemKind.File)
{
if (currentFileName == GOBACK)
currentPath = currentPath.Substring(0, currentPath.Length - Path.GetFileName(currentPath).Length - 1);
else
currentPath = Path.Combine(currentP...
I need to represent dates earlier than January 1 0001. Do you know a library that includes such a type?
It should provide the following functionality:
Add/Subtract
BigTimeSpan
Greater / Less than comparison
It would be ok if values would be less exact the longer the date is ago.
...
How can one read the AssemblyFileVersion, or its components AssemblyFileMajorVersion, AssemblyFileMinorVersion, AssemblyFileBuildNumber, AssemblyFileRevision, within the .csproj, following compilation?
I have tried the following which pulls the information from the built assembly:
<Target Name="AfterCompile">
<GetAssemblyIdentity A...
I seemingly have two choices:
Make my class implement IDisposable. Create my DbCommand instances as private readonly fields, and in the constructor, add the parameters that they use. Whenever I want to write to the database, bind to these parameters (reusing the same command instances), set the Connection and Transaction properties, th...
I want to produce some library code that will be included into WPF applications. The library may pop up a Window, depending on circumstances. I can define the Window in XAML, but I'd like to treat the XAML as a template. At runtime, at the time the Window is being created so that it can be displayed, I want to replace certain tags in t...
.NET provides four very similar versions of String.Format(...) (excluding the one that takes an IFormatProvider argument):
Format(String, Object)
Replaces one or more format items in a specified string with the string representation of a specified object.
Format(String, Object, Object)
Replaces the format item in a specified string with...
The HttpWebRequest class appears to be a rather heavy and functionality loaded.
I only need to (as quickly and low-overhead as possible) grab a response from a Url, without any other fancy functionality. What is the fastest method with the lowest overhead to achieve this?
Thank you!
...
I put a Yes/No/Cancel Messagebox in FormClosing Method of my form. and now this is Message box text: Do You Want to Save Data?
I am not a profesional and not know how to handle if user clicked Cancel Button?
Exactly the result of clicking on Cancel Button must be The form remain open. How to prevent Closing my form in FormClosing method...
Hello, I wondered if there is an easy way (sample?) to re-POST an incoming form collection to a different server.
The reason: I have server 1 which has a form with a bunch of fields, but they actually need to be stored on server 2. I can't allow people access to server 2 though, so I need to ask for the input on server 1. I'd still like...
Hi,
I have a bit old project that I would call legacy.
Some characteristics of it are:
It is a working product (for about 3 years) and is under continuous development.
Code-base is pretty large and includes (CS, SQL, ASPX, Jayrock, JS/HTML/CSS etc)
Platform is .NET 1.1.
IDE is Borland C# Builder 2006 (what a ...).
Other tool is Enter...
Hello,
My code follows. I have six items (indices 0-6) and I'm trying to check if one has been selected or not. If not, then messagebox yells at you to select one. If it does, it tells you what you have selected. I'm having a horrible brain fart and contemplated coming here for about 45 minutes as I couldn't get it.
If ListBox1.Select...
We have an existing .net 3.5 WCF service with which PreserveObjectReferences is set to true on the server side.
When PreserveObjectReferences is set to false BizTalk can consume the response.
Is there a way to get BizTalk to consume the PreserveObjectReferences response payloads...
PreserveObjectReferences manifests itself with a z:id...
There are some projects that could use WPF at work, for the sake of adopting new technologies.
But the problem is, I can't jump start WPF easily. I recognize the learning curve is steeper than Winforms. Though even with Winforms one can start doing UIs and programmatically customize them in a day.
So the problem is:
I don't have any ...
I am creating a script that retrieves data from a local oracle db. As of now I have the oracle data provider for .net installed. However, this is a big file and a long installation process. Is there a way to deploy a software that utilizes the System.Data.OracleClient without having to install the data provider?
...
I'm currently in the process of moving some code from native C++ to managed C++ (pure). The code involves interacting with Windows Active Scripting. Currently our native code provides a
class called 'ObjectDispatch' which implements 'IDispatch' (using ATL). This class implementation queries our own native class 'Object' at runtime to det...
Hi,
I am upgrading project from 1.1 to 3.5.
There are some references left to .NET 1.1 assemblies.
The question is:
Do I have the requirement now to have both .NET 1.1 and 2.0 (3.5) on the deployed machine or it can be run without 1.1?
Cheers,
Dmitriy.
...
I have to call some badly written 3rd party COM components that have memory leaks and uses Single Threaded Apartment [STA] within a long running process.
I know separate process will be nice way to implement it and I can restart it occasionally from the long running process.
Can AppDomain be used instead? Is AppDomain thread a STA thre...