Where Did Detach() Go In Entity Framework



TODO:

You are migrating old code to the latest version of Entity Framework, and you no longer have the Detach() method.  To fix, use the code below.

 

SOLUTION:

((IObjectContextAdapter)myModel).ObjectContext.Detach(myobject);

 

NOTES:

There are no notes on this topic.

How To Fix "Unable to update the entityset because it has a defining query and no UpdateFunction element exists in the ModificationFunctionMapping element to support the current operation" Error



TODO:

You try to insert a record using the Entity Framework and get the following error:

"Unable to update the entityset because it has a defining query and no <UpdateFunction> element exists in the <ModificationFunctionMapping> element to support the current operation"

 

SOLUTION:

Add a primary key to the table.  Also make sure the Concurrency Mode of the Primary Key is set to "Fixed" (right click column, choose properties)

 

NOTES:

There are no notes on this topic.

How To Fix "Internet Information Services Is Not Installed" Error When Running SharePoint 2010 Products Configuration Wizard



TODO:

You run the SharePoint Products Configuration Wizard, and you receive the error "Internet Information Services Is Not Installed", even though you have IIS installed.  the issue is the IIS 6 features are not installed, and are required.

 

SOLUTION:

Install IIS6 features, and your issue will go away.

 

NOTES:

There are no notes on this topic.

Possible Cause For "Sys.ArgumentException: Value must not be null for Controls and Behaviors. Parameter name: element" When Using Telerik RadGrid



TODO:

You have a Telerik RadGrid and when you click on the Add button, you get the " Sys.ArgumentException: Value must not be null for Controls and Behaviors. Parameter name: element" error.

 

SOLUTION:

In my case I had the following structure:

Panel 1

FormGroup (a control we built)

Panel 2

RadGrid 1

 

I had AjaxSettings in my code behind for "Panel 1" and "FormGroup".  Having AjaxSettings for the nested controls caused my issue.  I removed the AjaxSetting for "FormGroup" and the issue went away


NOTES:

There are no notes on this topic.

Causes And Fixes For "Error: Sys.ArgumentNullException: Value cannot be null." In JQuery



TODO:

You make some changes the ASP.net controls on your form, and possible your JQuery.  You run your application and you end up with "Error: Sys.ArgumentNullException: Value cannot be null."  

 

SOLUTION:

95% of the time I have had this issue, the problem was that I removed a control, and its references in the .cs file, but forgot it in the JQuery.  So in the JQuery I was doing a .hide() on the removed control which causes the cryptic error above.  To debug I simply looked for each instance of $('#mycontrolxxxxxxx').hide(); and made sure that #mycontrolxxxxxxx actually still existed.  Sure enough, I forgot to remove a JQuery line.  Once I removed the rogue JQuery line, the issue went away. 

 

NOTES:

There are no notes on this topic.

How To Fix "Team Foundation Error: Login Failure: Unknown Username or Bad Password" Error in Visual Studio



TODO:

In Visual Studio, you try to click on Security or other items, and you receive "Team Foundation Error:  Login Failure: Unknown Username or Bad Password"

 

SOLUTION:

You need to start Visual Studio as your Domain User

start -> run > runas /netonly /user:my domain\myuser "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe

 

NOTES:

There are no notes on this topic.

How To Fix "Error 1606. Could Not Access Network Location vmware-host" Error When Installing Software



TODO:

Have you ever received "Could not access network location..." when you attempt to install an application on Windows runnin in VMWare?

There are 2 sections of registry keys that need to be inspected.

 

SOLUTION:

Navigate to these 2 keys, and look for entries that hve invalid settings.  In my case the HKCU had an entry called "Personal", that had a path to \\vmware-host\shared folders\documents.  Once I changed that to "c:\Documents and Settings\myusername" the issue went away.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

 

NOTES:

The new path will require you to change "myusername" to your proper user name.

How To Fix The NativeStack Error In SharePoint 2010 When Deploying An Event Receiver



TODO:

Have you ever had the dreaded "Error occurred in deployment step 'Activate Features': <nativehr>0x80070002</nativehr><nativestack></nativestack>" error when deploying an Event Receiver that targets a specific list?

 

SOLUTION:

In my case, this was caused by an invalid 'ListURL' setting in my elements.xml file.  Be sure the 'Site URL' property of your project points to the site that the List resides.  If this is pointed to the level above, the list will not be found, and you will get the error above.  ListURL needs to be 'Lists/'{your list name}  ex. List/Customers, thus you see why it is important for the Site URL to be set properly.

 

NOTES:

There are no notes on this topic.

How To Check @@ERROR to Determine If An Error Occurred In A Stored Procedure



TODO:

Have you ever wanted to check to see if an update or other error occurred in your stored procedure.  To do so check the @@ERROR variable, if it is 0, then no errors occurred.

 

SOLUTION:

IF @@ERROR = 0
BEGIN
     --return the id of the row inserted
     SELECT @@ROWCOUNT As RowsAffected
END
ELSE
BEGIN
     SELECT -1 As RowsAffected
END

 

NOTES:

In the example above, I did not care about the error code, which is why i chose to return -1 in the ELSE.