What’s the difference between ViewData and ViewBag?

It uses the C# 4.0 dynamic feature. It achieves the same goal as viewdata and should be avoided in favor of using strongly typed view models (the same way as viewdata should be avoided). So basically it replaces magic strings: ViewData[“Foo”] with magic properties: ViewBag.Foo for which you have no compile time safety. I continue … Read more

Most useful NLog configurations [closed]

Some of these fall into the category of general NLog (or logging) tips rather than strictly configuration suggestions. Here are some general logging links from here at SO (you might have seen some or all of these already): log4net vs. Nlog Logging best practices What’s the point of a logging facade? Why do loggers recommend … Read more

Differences between Microsoft .NET 4.0 full Framework and Client Profile

What’s new in .NET Framework 4 Client Profile RTM explains many of the differences: When to use NET4 Client Profile and when to use NET4 Full Framework? NET4 Client Profile: Always target NET4 Client Profile for all your client desktop applications (including Windows Forms and WPF apps). NET4 Full framework: Target NET4 Full only if … Read more

Introducing FOREIGN KEY constraint may cause cycles or multiple cascade paths – why?

Because Stage is required, all one-to-many relationships where Stage is involved will have cascading delete enabled by default. It means, if you delete a Stage entity the delete will cascade directly to Side the delete will cascade directly to Card and because Card and Side have a required one-to-many relationship with cascading delete enabled by … Read more

What is the difference between CurrentCulture and CurrentUICulture properties of CultureInfo in .NET?

CurrentCulture is the .NET representation of the default user locale of the system. This controls default number and date formatting and the like. CurrentUICulture refers to the default user interface language, a setting introduced in Windows 2000. This is primarily regarding the UI localization/translation part of your app. Whatever regional options the system is configured … Read more

Visual Studio jump to next error shortcut?

F8 (and Shift+F8 to go backwards). Or at least that’s what it is in my keyboard profile – you can go to tools\options\environment\keyboard and check out Edit.GoToNextLocation. Note If you configured Visual Studio using VB keyboard settings, no key has been assigned to this function. You need to pick your own and assign them.

Could you explain STA and MTA?

The COM threading model is called an “apartment” model, where the execution context of initialized COM objects is associated with either a single thread (Single Thread Apartment) or many threads (Multi Thread Apartment). In this model, a COM object, once initialized in an apartment, is part of that apartment for the duration of its runtime. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)