.net

Dynamically create an object of <Type>

I have a table in my database that I use to manage relationships across my application. it's pretty basic in it's nature - parentType,parentId, childType, childId... all as ints. I've done this setup before, but I did it with a switch/case setup when I had 6 different tables I was trying to link. Now I have 30 tables that I'm trying to d...

Function Imports in Entity Model with a non-Entity Return Type

I have a stored procedure in my Entity Data Model and added it to the function imports. Problem is ... Visual Studio generates the function code in the model's code-behind if and only if I specify the return to be an entity type. Scalar and null return types do not work. Visual Studio does not generate the function code when I choose ...

Castle Windsor: Will my transient component be garbage collected ?

Using Castle Windsor, I have a component configured with the transient lifestyle: <component id="publish.mapping.default" service="IMyService, MyAssembly" type="MyServiceImplementation, Myassembly" lifestyle="transient" /> Which will be used like this: var service = container.Resolve<IMyService>(componentId); //...

How do I print a check?

I need to write a .NET library for printing checks. Nothing fancy: you pass in the data, out comes the printed check. What's the best way to do this? Constraints: The format of the check. ...

Is Forms Authentication Ticket Decryption possible with PHP?

I'm a PHP developer who knows almost nothing about .NET. I've been asked by the .NET guys at work to translate .NET code that decrypts an authentication ticket into PHP so that the PHP code can then set the appropriate session variables for my application to run. Is this even possible? I'm staring at the code and it's baffling me. I'll k...

Why can't a null-reference exception name the object that has a null reference?

It seems to me that a lot of my debugging time is spent chasing down null-reference exceptions in complex statements. For instance: For Each game As IHomeGame in _GamesToOpen.GetIterator() Why, when I get a NullReferenceException, can I get the line number in the stack trace, but not the name of the object that equals null. In other w...

what's the best practice for calling a webservice from within a trigger (SQL Server)

I have need to call a webservice when a particular column in a table changes. I can handle the deciding of which column changed in the insert/update/delete but I'm not sure how I should call the webservice. The webservice is offsite, we have a little control over it (we can ask for changes and get a reasonably quick response) but the s...

A .net disassembler/decompiler

I am looking for a disassembler or better, a decompiler for .net. The situation is that the source code for an assembly written by one of my predecessors is lost and I'd like to take a look to see what it's doing. I know that ildasm comes with the Visual Studio installation so I can get at the MSIL, but I was hoping there was a program...

Starting external process from ASP.NET

I need to start an external process from my web application. This means using System.Diagnostics.ProcessStartInfo to call out and execute a console app (exe). But I then need to somehow make sure nothing went wrong during it's execution and know when the application completed its work. What's the best way to both catch all possible err...

Dynamically Created User Controls In C#

I am working in a C# winforms project and I have a user control which gets loaded upon its selection from a tool-strip menu. I have a dictionary lookup set to occur upon form load of the user control for other functionality. Also, when I close the user control I am just using the ".Hide();" method. I noticed that when I load the user con...

Managing 2 web references with shared class dependency in a .NET project

I have a web service project that has 2 asmx files. Let’s call them internal.asmx & external.asmx In practice, these have different clients: Externally a client will call externalWS.PersistOrder(Order order ) and internally, we process the order internalWS ProcessOrder(Order order). Therefore the Order class is a shared dependency acr...

How can I write a unit test to determine whether an object can be garbage collected ?

In relation to my previous question, I need to check whether a component that will be instantiated by Castle Windsor, can be garbage collected after my code has finished using it. I have tried the suggestion in the answers from the previous question, but it does not seem to work as expected, at least for my code. So I would like to write...

POLL: What do you call your business layer base namespace?

I have a simple solution with the following projects as follows (base namespaces match the project name)... MyCompany.MyProduct.BusinessLayer MyCompany.MyProduct.Web.Service MyCompany.MyProduct.Web.Site I'm just trying to find a better name for BusinessLayer, I just don't really like it for some reason. So my question is what do you ca...

Config files for GAC objects

Typically we keep our config values in web.config/app.config and for the environment global config varialbes (and not application specific) in server machine.config file. When deploying an object to the GAC where is the best location to keep these config type values? It seems that the best location would be a linked resource file. D...

RSS description html sanitizing in .NET

I want to write an application that consumes RSS. I want to be able to show some items in the item description of the RSS feed as HTML, such as images, links, br, etc. However, I don't want any embedded scripts to run, unruly css elements, etc. I don't want to re-invent the wheel either. Are their any libraries that strip out just th...

How can I initiate a Remote Assistance session in .NET?

I'm writing a help desk application and would like to allow my users to initiate a Remote Assistance session on a remote PC. This can be done via Help in Windows XP, but I haven't been able to find any code sample in .NET. Thanks! ...

Instantiating a python class in C#

I've written a class in python that I want to wrap into a .net assembly via IronPython and instantiate in a C# application. I've migrated the class to IronPython, created a library assembly and referenced it. Now, how do I actually get an instance of that class? The class looks (partially) like this: class PokerCard: "A card for pl...

Unit Testing Mere Mortals .NET Framework

Assuming a client already has chosen to use the Mere Mortals Framework from Oak Leaf Software, what would be the recommended approach to allow for unit testing and proper separation of concerns for the resulting application? Ideally I'd like to achieve something like SOLID design principles and have layers that are not all completely co...

Easy way to add an ID column when there is data present

Is there an easy way to add an ID (Identity(1,1) & PK) column to a table that already has data? I have picked up a project that was freelanced out to a horrible developer that didn't put a PK, index or anything on the tables he made. Now that I am LINQ-ifying it, I have no PK to insert or update off of. ...

Why does the MSTest wizard the F suffix for doubles instead of D?

When I create a test using MS Visual Studio's builtin unit test wizard it creates code with lines like the below: double number = 0F; In C# "F" stands for float, case-independent, and "D" for double. Using "F" suffix instead of "D" leads to precision lost. If it's a bug, where can I report it to Microsoft? ...