.net

Sql code formatter for .NET (SQL Server 2008 dialect)

Can you please point me to a an SQL code formatter, preferably as an opensource library for NET? I need to make sql source code invariant to the formatting, because i would like to make consistent diff on version control system merges, and it's not easy to maintain in generated code mixed with snippets of handcrafted code. My idea is t...

linq distinct not giving distinct results

I am pasting my code below; My base class is overriding Equals and getHashcode but the linq query is not returning distinct results. There are multiple cities in the results that have the same ID. public class Product : EntityBase { public virtual string Name { get; set; } public virtual IList<ProductDayDefinition>...

What are default settings used by .net user login control api for AES algorithm?

I am using same user name and password login for a user on two web applications (one in .net 3.5 and other in java 1.4). Both websites are using different database on same server.For maintaining user name password authentication .net user login-control is used.when user updates his password we need to update same password in database use...

Winform application layout - dealing with different DPI practices

We have a winform MDI application, there's quite a lot of forms/dialogs. Some are laid out with absolute location and sizes, some are laid out using table/flow panels. Overall appearance looked good under different screen resolutions. Until someone tested it on a machine where the DPI was set to 120. While mostly things looked good, som...

.NET Multicast Socket Error

I have an app that uses 2 multicast channels, so _sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPEndPoint iep = new IPEndPoint(IPAddress.Any, 30002); _sock.Bind(iep); _sock.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.255....

How to refresh applicationSettings in a dll

Can i force a dll to reload it's configuration? In my VB library I'm using this configuration: <applicationSettings> <ComWrapper.My.MySettings> <setting name="MySetting" serializeAs="String"> <value>This is an entry</value> </setting> </applicationSettings> It's no problem to access the "MySetting" val...

How to get a value through a out/ref parameter from a method which throws an exception?

this code outputs "out value". class P { public static void Main() { string arg = null; try { Method(out arg); } catch { } Console.WriteLine(arg); } public static void Method(out string arg) { arg = "out value"; throw new Exception(); } } but this one doesn't. class P { publ...

How do I see the value of a GUID in the Visual Studio 2008 debugger?

When you look at a GUID values item in the watch window you do not see the value of the item, when you expand the item you just see “Empty” this is very misleading! You have to add “ToString()” to the value to see something useful. So how do I get Visual Studio to add the “ToString()” it’s self? I am using VB.NET if it make a differ...

Can I pass a type object to a generic method?

Hi, I have a FindAll method on my DataAccessLayer which looks like this: public FindResult<T> FindAll<T>() where T : Entity, new() and a client code that has a Type[] array which it needs to use to iteratively call the FindAll method with like this: foreach (var type in typeArray) { var result = DataAccessLayer.FindAll<type>...

NHibernate - Domain Driven Design - Business Rule Question

Hi all, I ve got an employee that holds several addresses in a collection. public class Employee { public string Name { get; set; } public AddressCollection Addresses { get; } } public class AddressCollection : IEnumerable<Address> { private readonly Employee employee; private IList<Address> items = new List<Address>...

Problem using oracle.dataaccess.dll

Hi, I have an web application which uses Oracle.DataAccess.dll to communicate with and Oracle db. The web application deployed on 32 bit windows system works but not on windows server 2008 64 bit. I installed 10204_vista_win2k8_x64_production_db package, referenced the installed dll (version 2.102.4.0) from the project but I get the fol...

Do .NET assemblies ever change?

Hey, I have a need to provide a 32-bit CRC (Cyclic Redundancy Check) of all assemblies, which is stored (for release control purposes), and may then be compared against the assemblies present on a system at a later date (in order to check that the release hasn't been corrupted in some way). I have no problem calculating the CRC of the ...

How to I serialize a large graph of .NET object into a SQL Server BLOB without creating a large buffer?

We have code like: ms = New IO.MemoryStream bin = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bin.Serialize(ms, largeGraphOfObjects) dataToSaveToDatabase = ms.ToArray() // put dataToSaveToDatabase in a Sql server BLOB But the memory steam allocates a large buffer from the large memory heap that is giving us prob...

Alternative to dompdf (PHP Tool To Cnvert HTML+CSS To PDF) But in .NET?

From their site (Free Project On Google Code): http://code.google.com/p/dompdf/ dompdf is an HTML to PDF converter. At its heart, dompdf is (mostly) CSS2.1 compliant HTML layout and rendering engine written in PHP I need to have the same functionality in an ASP.NET website. Is there any good free alternative that can work wit...

How to add User control in the toolbox for C#.net for winforms by importing the dll to the reference ?

I have one dll of usercontrol and I add to it to the references in my project. And now I want to access this usercontrol from toolbox but it does not appear in the toolbox. And I can access them by writing code, but I want it in toolbox and want to use by just dragging it to the form. ...

How do I retrieve ApplicationSettings from a loaded app.config file

Is it possible to access the values from the applicationSettings section of a loaded app.config file? I have found an example How do I retrieve appSettings, but i can't find out how to access applicationSettings this way. ...

How to Stream data from/to SQL Server BLOB fields?

For the background to this question, see “How to I serialize a large graph of .NET object into a SQL Server BLOB without creating a large buffer?” that now has a large bounty on it. I wish to be able to use a Stream object to read/write data to/from a BLOB field in a SQL Server row without having to put the all the data in...

Resource leaks when using a VCL (C++Builder) DLL from .NET

I have a DLL that's written in C++Builder (2006), and I'm invoking a single function in the DLL from a .NET application. The problem is, when I close the .NET application (and the DLL gets detached from it) I get a CodeGuard error saying that it detected resource leaks (and I see the leaks in the CodeGuard log file). I also see the Loa...

Save WinForm to PDF & print multipage WinForm

How can I save multipage WinForm to PDF & how can I print it? thanks, Ofir ...

Need a tool to dump the referenced types and members for an assembly

I need a tool that can dump the referenced types used by an assembly in a machine readable format. e.g. this Code in assembly 'dummy.exe' static void Main() { Console.WriteLine("Hello World"); } would produce something like <references assembly="dummy.exe"> <mscorlib> <System.Console> <WriteLine/> ... Can you do this...