.net

Are there any gotchas or good reasons not to use autosproc for stored procedure calls?

I've implemented a data access layer that populates generic entities from a datareader using a variation of the third monkey approach (http://www.codeproject.com/KB/database/DynamicMethod_ILGenerator.aspx). This works well, performs well and saves me writing loads of repetetive code for data retrieval. Now I want to add methods that tak...

Why group by key of anonymous objects does not behave the way expected ?

I have a csv file of this formart A,B,value a1,b1,10 a2,b1,12 a2,b1,15 a2,b2,14 a1,b1,12 which I am converting as datatable in my application. Dim enumerable = _dt.AsEnumerable Dim groupedResults = enumerable.GroupBy( _ Function(x) _ New With { _ ...

How does FileSystemWatcher work on another computers directory?

Something intrigues me and I don't find any resource on this. How can FileSystemWatcher know when a file on a computer "A" is created/removed/changed/renamed ? I thought that this worked with polling, (the observer polls the server to check update), but after verifying the network activity with Wireshark I saw that polling was not use...

Using Visual Studio to make non aspx code-behind pages

I want to build my own "code behind" like pages so that i can have HTML in a HTML file and code in cs file but be able to have Intellesense for the tokens in the HTML file. (i know that's what the .NET page class does, but i want to have something much lighter) EG: in the .html file: <%@ Directive classname="HTMLSnippet" %> <html> <...

Prepared Statements With MySQL in .Net @ VS. ?

According to the MySQL .Net connector docs, when running prepared statements, the @ symbol is used to defined a paramter. When trying this I got an error. Then the user comment at the bottom of the page says if you have problems, substitute the ? for the @ character. Is there any way to control what character MySQL expects for prepare...

dr watson crash dialog on closing a .NET 2.0 app

We occasionally get a dr watson crash dialog on process exit. The process is .NET 2.0. The dialog is not very helpful. It says that the process stopped working and in the details I can see that it was about System.NullReferenceException, great but where is the traceback? Normally when there is an error in .net process a traceback is pri...

Silverlight/WCF login session

I am working on a system with Silverlight and using WCF to call services to do all of the work on the server side. I need to have a user log into the system, and once they are verified, all calls to the server need to contain the user info so the server can check security policies and do other operations based on the user. What is ...

Passing Parameters to Pages in a Secure Manner

Hi I was wondering in .NET 2.0 what is the best way to transfer parameters between pages? I cannot allow the user to modify these parameters, so I was thinking of using Session variables. Is this a safe method? Is there a way for the user to modify it? ...

Extension Method Help

I am writing an extension method where I happen to need the field name that the extension method is needed within the extension method. I can not figure out how to do this. My code: Extension method: public static Validate Demand<T>(this T parameter) { string name = ... var field = GetField(parameter); return Validation....

WPF or WinForms for internal tools?

At my company we develop a number of tools for internal that range from simple utilities to full-blown editors. The priorities for these tools are stability, usability, and turn-around time (meaning how quickly new features can be added). We've been using WinForms up until now but there's a couple of new tools on the drawing board and I...

Determining if a parameter uses "params" using reflection in C#?

Consider this method signature: public static void WriteLine(string input, params object[] myObjects) { // Do stuff. } How can I determine that the WriteLine method's "myObjects" pararameter uses the params keyword and can take variable arguments? ...

How can I get the path of a compiled resource?

I have included an executable in my project ( i.e. when you unfold the project in the Solution Explorer in VS2008, you see it along with all the other classes). This executable will need to be launched by my program. How can I retrieve its path programmatically? ...

.Net WebDAV Server

Hi all, I am looking to implement a WebDAV server in ASP.Net. the app will be deployed to IIS 6. I have seen a few frameworks that provide this functionality, but I can't seem to identify how they're able to accomplish it without (apparently) modifying IIS settings. My specific question is how do I configure IIS and ASP.Net so that a IH...

Why do I get the following output when inverting bits in a byte?

Assumption: Converting a byte[] from Little Endian to Big Endian means inverting the order of the bits in each byte of the byte[]. Assuming this is correct, I tried the following to understand this: byte[] data = new byte[] { 1, 2, 3, 4, 5, 15, 24 }; byte[] inverted = ToBig(data); var little = new BitArray(data); var big = ...

Linq Fetch all controls (ordered)

Is there a way to fetch all the control using linq. What I'll like to do is something like that (order the control by tab index) : foreach (Control control in this.Controls.OrderBy(c => c.TabIndex) { ... } I use that kind of query when I got a List<...> I use c# and .Net 3.5 ...

Where can I advertise/buy a .NET library?

As part of a project at work I have developed a library that my company is thinking of marketing independent of the containing project. Where would be a good place to market it? I'm thinking something cheap (free) and low key like an add supported list of links site or the like. As this is just a side bit, there is almost no budget for...

ASP.NET MVC - Getting QueryString values

Under ASP.NET MVC are you supposed to pick up QueryString params the same way you do in ASP.NET WebForms? or does the [AcceptVerbs(HttpVerbs.Get)] declaration get used somehow? ...

Linq query to return a Dictionary<string, string>

I have a collection of MyClass that I'd like to query using linq to get distinct values, and get back a Dictionary as the result - but can't figure out how I can do it any simpler than I'm doing below. Does anyone have some cleaner code that I can use to get the Dictionary as my result? var desiredResults = new Dictionary<string, s...

DDD User Security Policies

I have a RentalProperty class which looks something like this: class RentalProperty { Money MonthlyRent; List<MaintainenceCall> MaintainenceCalls; } From my understanding, using DDD to change the MonthlyRent, I would get the RentalProperty, change the MonthlyRent property, and call RentalPropertyRepository.Save(). The same pr...

How to load web.config while using MS Test

I am testing some business object's Save() method. In order to save object, I need to read connection string from Configuration Manager. But all I get is null value. My settings are in web site web.config. How can I obtain during test runtime. Do I need additional configuration. ...