.net

Should I start with Unit testing when teaching a new developer?

I'm currently working on a project that is using technologies like Silverlight, WCF, EnterpriseLibrary, Unity, LinqToSql, NUnit, RhinoMocks in .Net 3.5 I'm training up a new developer who has some experience with VB script and SQL, but no exposure to .Net Almost 100% of the codebase has unit test coverage, but it just seems that gettin...

How to implement WCF REST in ASP.NET

I'm trying to write a re-usable .NET Assembly that implements WCF. My current problem is how to take the assembly (appropriately decorated with ServiceContract, DataContract, and WebGet attributes) and reference it in my existing ASP.NET WebForms application and expose it using REST. Ideally I like different endpoints for JQuery compat...

.NET 32-bit dev vs. 64-bit prod

This question is kind of related to another question but I have a specific scenario in mind. We do our development on 32-bit machines and deploy to a 64-bit server. The application is an ASP.NET Web Application and we use SQLite for the backend of this application. When I try to build on the remote machine I get errors from MSBuild sa...

Linq To Sql and identity_insert

I am trying to do record inserts on a table where the primary key is an Identity field. I have tried calling mycontext.ExecuteCommand("SET identity_insert myTable ON") but this doesn't do any good. I get an error saying that identity_insert is off when I submit changes. How can I turn it ON from the c# code before I submit changes? E...

ToolStripControlHost hosting a UserControl designer Serializing won't occur

I am currently developing an application in which I want to display a UserControl inside a context menu. I was able to (somewhat achieve this using ToolStripControlHost). Shown in (NumericUpDownToolStripItem code): below is code for the object (written in VC++.net 2.0). Note: There are semi-similar SO questions on this, but none seem ...

How do you check if you are running in Medium Trust environment in .NET?

I am running a website on shared hosting at GoDaddy (not my choice, because it is always Medium Trust), and I have some advanced features that I would like to turn on if the application is run in High Trust. So would like to know, if there is an way to check if at runtime if the application is running in Medium Trust environment in .N...

Simplified .net API for beginners?

I'm in the middle of teaching myself C#, and I come from a C++ background. I think one of the hardest aspects of learning managed code is becoming familiar with the API. Is there a simplified version somewhere /w the basics that will allow someone to generate a WinForm or WPF app? Thanks. ...

How to determine which classes are referenced in a compiled .Net or Java application?

I wonder if there's an easy way to determine which classes from a library are "used" by a compiled .NET or Java application, and I need to write a simple utility to do that (so using any of the available decompilers won't do the job). I don't need to analyze different inputs to figure out if a class is actually created for this or that ...

Resuming C# threads

Possible duplicate question: http://stackoverflow.com/questions/142826/is-there-a-way-to-indefinitely-pause-a-thread In my code i do the below Thread mainThread //... mainThread.Resume(); void StartThread() { while (!wantQuit) { db.runEmail(); mainThread.Suspend(); } } Then i get the exception below be...

Directory.GetFileSystemInfos(string) returns non-matching files.

I'm using the follow command to get a list of FileSystemInfo's IList<FileSystemInfo> requestFiles = new List<FileSystemInfo>( _RequestDirectory.GetFileSystemInfos(GetSearchPatern())); Get search pattern returns "*.exr". The list still includes files that end with ".exr2", but does not include thos...

Automated letter generation

I work for a doctor and am looking for a solution to speed up his process of composing medical reports. Most of the text in the medical reports are redundant and should be able to be generated by a selection process What I would like is to present him with a form with various options, checkboxes and the selections he makes will drive th...

comparion/performance of database field as int vs char(1)

does one perform better over the other in terms of indexing/quering etc ? e.g. declaring a column as active Char(1) with 'Y' / 'N' values vs is_active tinyint with values 1 / 0 Anecdotally speaking most places it seems people prefer to use char(1) whereas my tendency is to declare them as tinyint/int not the least because it's easy...

WCF service instance will not close despite only calling oneway method

I have a WCF service running inside a windows service on a remote machine. In the WCF service's contract, I have a method that takes a long time to run set up as [OperationContract(IsOneWay = true)] void Update(myClass[] stuff); Everything works fine, the method gets called, I can see what it needs to do start getting done. The prob...

DateTime Xml Deserialization

Sorry if this issue has been beaten to death, but I can't seem to find a good answer to my question. I have written a .NET 2.0 client that consumes a web service. The web method I call returns several DateTime values in UTC format. It appears that the values are being deserialized as DateTimeKind.Local. I assume this is the default...

Error tag in Web.config customerErrors section needs an Int32 statusCode?

I keep coming across web examples of setting up custom error pages, and people do things like this: <customErrors mode="RemoteOnly" defaultRedirect="GeneralError.aspx"> <error statusCode="401.2" redirect="4012Error.htm"/> </customErrors> I know that a 401.2 redirect has its own set of headaches, but IIS isn't complaining about tha...

Share a folder between two Asp.Net web applications in the same solution

Hi, I'm currently working on an Asp.net MVC Web application. In my solution, there're two projects: front office and back office. I'd like to share a folder that'll contain resources such as images, documents, etc... that'll be uploaded through the web application. For example, when I upload an image using the back office, I only need ...

Opinions on DoFactory framework?

Dofactory has a 3.5 framework for developing software and includes some design patterns which are explained in a document. There's a sample app built using the framework which has user interfaces for WinForm, WPF, ASP.NET (WebForms), ASP.NET MVC, plus DAL's using Linq & ADO.NET which makes it a candidate for a learning tool and a framewo...

Creating a Hand-Drawn effect using .NET

I'd like to write a piece of code which creates images similar in style to those rendered by 'Balsamiq Mockups' or 'yUML' using the .NET framework. Can anybody tell me how to achieve the hand-drawn pencil effect using GDI+? The text can obviously be done using the right font - my question is how to render the lines, boxes and circles. ...

WPF Toolkit: VisualStateGroup Bug?

I am getting an odd intermittent bug that seems to ve related to the VisualStateManager in the WPF Toolkit. I am developing an application that uses the Toolkit (June 2009), but not the VisualStateManager. Nonetheless, I am getting the following error: 'TextColor' name cannot be found in the name scope of 'System.Windows.Controls.Grid'....

Custom Output directory for a .NET Web Project

Whenever I choose a custom output folder in a WCF Service or Web project in VS .NET 2008, running the project always gives me errors or inconsistencies as far as finding the right referenced assemblies. For example, if the output folder is < solution root >\bin instead of < solution root >\Project\bin, the project will still attempt to ...