.net-4.0

C# syntax - Colon after a variable name

Hey everyone, Quick question; I've recently upgraded to VS2010, and got the new version of ReSharper. Now, when ReSharper is giving me autocomplete options for a variable, it give me the option of <variableName>: What does the : stand for? For example; I have this: var productIds = new List<int>(inventoryItemsToProcess.Keys); And ...

Is it possible to name a dependency with StructureMap?

I would like to be able to inject named dependencies into a class using StructureMap if that is at all possible. The main reason I want this right now is for connection string injection. I may be doing this the wrong way, but here's how I've got it (just need to add injection now): psuedo: public class MyServiceClass string conne...

Entity Framework simultaneous multiple inherited types

I am trying to use inherited types with EF, which has been all cool and gravy until now. I have a base type (Person) and two types that inherit person (Employee & Customer). I run into a problem when I want a person to be an Employee and a Customer at the same time. For example: Person person = db.Persons.Single(p => p.id == id); if (...

WCF .Net 4.0 Client Error in deserializing body of reply message

Hello, I am trying to get a WCF .Net 4.0 client to work with a NuSOAP/0.7.2 (1.94) Web Service. First thing, the web service is not based on current SOA standards so I had to create a custom encoder to handle the ISO-8859-1 message encoding. When I get the response, WCF throws the following exception "Error in deserializing body of ...

Better approach to saving Webpage content to database for caching

hi, i want to know which approach is better to saving Webpage content to database for caching? Using ntext data-type and save content as flat string Using ntext, but compress content and then save Using varbinary(MAX) to save content (how i can convert flat string to binary? ;-)) An other approach which you are suggest to me UPDATE ...

is it ok to use plinq ForAll for a bulk insert into database ?

I'm doing like this: entities.AsParallel().ForAll(o => repository.Insert(o)); is this good, am I going to have more performance with this ? ...

How can I create a DynamicProxy for a WCF proxy that is generated by ChannelFactory<T>?

I am using ChannelFactory to create a proxy at run-time for a WCF service. I would like to use the DynamicProxy Castle project to create a dynamic proxy on top of the WCF proxy so that I can intercept calls and do impersonation. I'm getting an error when I try this though... the error message is: 'this' type cannot be an interface i...

Running WCF 3.5 app under .NET 4.0 website

I have a website that is hosted on IIS6 and set to use .NET 4.0, but I still have a WCF service on the site that is using 3.5. When i browse my svc file, i get the error: unrecognized attribute 'targetFramework' and it point to the websites root web.config. I have tried this MSDN article and still get the same error. My site is usi...

.NET 4.0 Entity framework Error on Insert?

I don't know why it's is error on SaveChanges(), i search in google, some body say using EF, the database's table such have primary key, i have this, but still error. The error message is not enough clear,it just throws System.Data.UpdateException. The Code: public static void AddAccount(int _acc_id,string _name) { dataEntities de =...

Caching MVC .NET 4.0

Hello, I am trying to cache a selectlist which is not null but I get a null exception error. The line of code causing the error is: (note item is created using Cache item = new Cache(); and tripVM.friendDropDown holds the selectlist item.Insert("friendDropDown", tripVM.friendDropDown,null,DateTime.Now.AddMilliseconds(10000), TimeSpa...

What is the difference between Entity Framework and LINQ to SQL by .NET 4.0?

I was checking 2nd edition of Professional ASP.NET MVC and realized EF replaced LINQ to SQL. I am familiar to LINQ to SQL from the first book but I know nothing about EF. Anyway while reading the code, it seems like nothing has changed except the name. Same old repository, same old functions. I did a little research. I know LINQ is not...

Moving an ASP.NET project to .NET 4

I'm moving an ASP.NET project from .NET 3.5 to .NET 4. Everything works beautifully if I'm debugging under web.dev (ie. in Visual Studio [2010]) but as soon as I try and run this under IIS7[.5] the debugger fails to attach. Running the project directly under IIS just causes it to throw back 403s (no subcode, so not much help there). I...

error in implementation of xlinq wrt .net 4.0

My code is as bellow ,i have a xml file in xml folder in root i get an error type or namespace Movie not found. I think i am following what wrox book has said i get this error,can anyone help me out. using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System...

WIX Custom Actions built for .Net Framework 4.0 does not work? Ways to resolve?

We were using WIX 3.5 (Build Number 1811) and built a custom action built using Visual Studio 2008 and with target framework as .Net 3.5. This used to work great, until we built the custom action using Visual Studio 2010 and with target framework as .Net 4.0. WIX is unable to invoke the custom action, the error that we get is this: S...

EnableDynamicData can i use for textbox or dropdownlist

hi, can anyone tell me whether i can use EnableDynamicData for textbox or dropdown list?? From what i can find i cant? Perhaps i can add this functionality by inheriting specific class?? thanks NIall ...

Why am I getting Could not load file or assembly error on a System.Configuration DLL when using framework 4.0?

Immediately after we upgraded to visual studio 2010 and the 4.0 framework our trunk build started breaking with the Could not load file or assembly error. We determined that a 3.5 project couldn't reference a 4.0 project else we'd get this error because, as the error states, This assembly is built by a runtime newer than the currently lo...

NHibernate 1.2 in a .NET 4.0 solution

Hello, I have some projects based on NHibernate 1.2 and I'd like to add them to a .NET 4.0 solution, but I get an AmbiguousMatchException. No matter if these projects are targeted to 2.0 or 4.0 framework. It works if I add them to a .NET 3.5 solution. Does anyone have experience with that? Here is the exception: [AmbiguousMatchExcep...

RESTful web services

I am new to RESTful web services. We are taking the REST route for building our public web services to be consumed by out clients.And i had a few questions. Are there any kind of limitation with pure REST webs services? and if yes then would a hybrid REST web service take care of those limitations? I am thinking about using SSL + Hash...

.NET 4.0 framework dynamic features in VB with Option Strict On?

Is there any way to use the new dynamic features in the 4.0 framework like ExpandoObject in VB.NET without setting Option Strict Off? With C#, you lose type safety only with the variables you specifically declare as dynamic. But with VB, the only way I've found to use these features is with the old Option Strict Off trick that's been in...

Receiving "...has already been registered..." from EventLog.CreateEventSource even though I'm checking !EventLog.SourceExists

My following code fails with "...has already been registered as a source on the local computer" even though I'm doing checks first: lock ( eventLock ) { string eventLog = Constants.EventLogPL; string eventSrc = Constants.EventSrcPL; if (!EventLog.Exists(eventLog)) { if (!EventLog.SourceExists(eventSrc)) ...