.net

How do I load an image from a database in ASP.NET MVC?

I have saved an image on the database and want to display it to the user. The table the image is stored in looks like this: Images ------ ImageData Byte ImageName String ContentType String What should I do to load and show it in my View? ...

Multiple enumerators for an IEnumerable

I have a custom made collection that has many modes of objects generations inside of it. It can generate everything, one object at a time or N objects at a time. I would like to have the option to switch between implementations of generation on runtime, and even maybe create new ones. I am looking for something with this kind of syntax: ...

Is it bad practice to use generics as return values from functions?

Somebody told me this but i have not seen this anywhere and i have used it all over, i don't see why would it be bad practice. Example of what i mean is having functions such as: public List<SomeCustomeType> GetListOfStuff() { } or public void DoSomeStuff(List<SomeCustomeType> param) { } can anyone tell me why would this be bad p...

How to configure .NET framework on Windows 7

Hi ! I don't find the graphic tool to configure my .NET framework on my windows 7. Thanks Robie ...

I need to improve my T-SQL query so that i can return the sum of columns

Here is my current query: SELECT patron_name, producer.federal_number, hst_number, average_bf_test, (SELECT MAX(s.statement_number) FROM statement s) AS statement_number, (SELECT MAX(s.period_ending) FROM statement s) AS period_ending FROM producer JOIN producer_details ON producer.federal_number = pro...

How do you deserialize Transunion XML?

Here is my attempt, xsd and classes created from xsd.exe Running my code I get error "There is an error in XML document (1, 2)." Inner exception {" was not expected."} Any help would be greatly appreciated. Thanks! XML Snippet: <xml> <creditBureau xmlns="http://www.transunion.com/namespace" xmlns:xsi="http://www....

.NET Assembly References Overview

Does anybody know of a good tool or piece of code that will allow me to produce an overview of the assembly references a project is using? I'd like to see the Assembly Name, version, path, etc of all the assemblies in a spreadsheet format. Thanks ...

Entity Framework 4 CTP 4 Code First: how to work with unconventional primary and foreign key names

Is there a way in Entity Framework 4 (using CTP4 and Code First if that matters) to change the conventions used to automatically identify primary and foreign keys? I'm trying to use EF with a legacy database that uses a "pk/fk" prefix rather than an "id" suffix to mark keys. Also, it's not uncommon to have multiple foreign keys to an A...

.Net: State of the Art in tools & frameworks

This is question for those who work in .Net and are curious enough to expand their toolset, including also things beyond Microsoft's solutions. Coming from the Java world, there is a toolset I would consider using every new project, such as: Spring for IoC and MVC. JPA/Hibernate for persistence and ORM. JUnit/TestNG for unit testing. ...

Table doesn't have a primary key

i get the following exception (missing primary key) in the line of using Find() method "Table doesn't have a primary key." I've rechecked the Database and all Primary Key columns are set correctly. my code: DataTable dt = p.GetAllPhotos(int.Parse(Id)); DataTable temp = new DataTable(); temp = dt....

Getting ReflectionTypeLoadException on 2nd attempt at reflection in .net 4

In my project I have the following helper method, which goes through all the assembly and gets all types that are subclasses of the BaseCamaFrom type. public static List<Type> GetAllTestActionFormTypes() { List<Type> types = new List<Type>(); // add all the types that are subclasses of BaseCamaForm to the _camaF...

C# #if / #ifdef syntax doesn't compile, why ?

Why does the below code not compile (snippet) ? public enum ApplicationType : int { CONSOLE = 1, WINDOWS_FORMS = 2, ASP_NET = 3, WINDOWS_SERVICE = 4, MUTE = 5 } //#if( false) //#if (DEBUG && !VC_V7) #if( m_iApplicationType != ApplicationType.ASP_NET ) public class HttpContext { public...

Cannot get self host to work on NServiceBus

Using version 2.0.0.1219 I am attempting to self host both a subscriber and publisher with NServiceBus and VS2010. The programs run and initialize but I cannot get the messages to move across. The publisher acts like it is posting, no errors, but the subscriber receives nothing. Here is the subscriber config <?xml version="1.0"?> <c...

Why are some object properties UnaryExpression and others MemberExpression?

Acting on the answer to my Select a model property using a lambda and not a string property name question, wanting to add properties to a collection as follows: var props = new ExportPropertyInfoCollection<JobCard>(); props.Include(model => model.BusinessInstallNumber).Title("Install No").Width(64).KeepZeroPadding(true); props.Include(...

WPF show dialog at startup

I have a flag if set I would like a connection Dialog window to showup on startup. In App.xaml.cs in the Application_Startup event handler I have the code to show the window. What is happening is the splash screen shows (a png set to splash screen), the dialog pops up for a second then closes and the main WPF window displays. I would ...

Take every 2nd object in list

I have an IEnumerable and I want to get a new IEnumerable containing every nth element. Can this be done in Linq? ...

C# Networking TCP/IP?

Hi All I am in need of some websites where I can buy C# WinForms networking libraries/components/dll's from. Can anybody please suggest any? They should be pretty cheap, but any and all links are welcome :) I can only find one website, and I don't like the look of what they have. Thank you ...

SQL Caching and Entity Framework

I have put together a small ASP.NET MVC 2 site that does some very extensive date mining/table-joins/etc. Using MVC, I have a controller that returns the data in many different forms (tables, images, etc). To save hitting the database frequently I have a dual cache mechanism: For identical parameters to the same action I use the O...

WPF: Cannot reuse window after it has been closed.

I am trying to keep one instance of a Window around and when needed call ShowDialog. This worked find in winforms, but in WPF I recieve this exeception: System.InvalidOperationException: Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed. Is there any way to do something li...

VB.NET - Alias to class' properties

I have an object and I iterate over object's properties. Foreach property, i append it as a column to a listview. In my object, some properties doesn't have accents. But in portuguese, they do. For example: "Endereco" property must be "Endereço". I need an away to create an alias to the properties. Is it possible in VB.NET? Thank you. ...