Entity framework designer “Type ‘ObjectParameter is not defined” with old code generation items

Errors:

  1. “Namespace or type specified in the imports ‘System.Data.Objects’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure that the imported element name doesn’t use any aliases.”
  2. “Type ‘ObjectParameter is not defined” with old code generation items

 

The code generation item was created some years ago. Now whenever the myModel.context.tt is executed it puts “Imports System.Data.Objects” at the top of the Model.Context.vb file.

 

Solution

It provides a suggestion of “Change ‘System.Data.Objects’ to ‘System.Data.Entity.Core.Objects’ which is easy enough to do, only you will have to do it next time as well.

So do the change then actually copy the “Imports System.Data.Entity.Core.Objects”

into the Model.Context.tt file, so that next time it will generate correctly.

 

End.

 

Advertisements

MS Word 2013 ActiveDocument.MailMerge.OpenDataSource not available for reading on opening a document

A new PC has MS Office 2013 when the system still uses Office 2003 templates and vba code.

Error:

Don’t have actual text to hand, but something like:

“MailMerge.OpenDataSource is not available for reading”

 

Solution:

Programmatically change the view on open:

Private Sub Document_Open()
Me.ActiveWindow.View.Type = wdNormalView
End Sub

 

Found solution on web. Following was not the page, but similar

http://blogs.msmvps.com/wordmeister/2013/02/22/word2013bug-not-available-for-reading/

http://social.msdn.microsoft.com/Forums/expression/en-US/d68fe679-6a44-4437-b64a-ab6dfce4fa78/problem-with-activedocumentmailmergeopendatasource-read-only-words-documents-office-2013?forum=worddev

 

 

 

Visual Studio Extension Manager – Favourite Extensions

The extensions I find use are:

  1. NuGet
  2. Reference Assistant for Visual Studio 2010
    Remove unused references. In VSĀ for VB, but not available in C#
  3. Language Convert
    Convert VB.Net to C#
  4. Search Work Items for TFS 2010

 

 

Index was out of range. Must be non-negative and less than the size of the collection. – On close form – DataGrid column

When closing a Windows Form on a button using Me.Close then get the following:

Error

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Solution

Tabs with Detail and List using a DataGridView, both

Had switched a BindingSource from a data table to a data source (object) which used a different field, so the DataGridView lookup column now had an invalid column.

Change to new column name and it will work.

End.

 

SQL Server hangs on drop foreign key

This actually happened on Azure during part of a SSIS SQL Server integration package, removal of key before delete and upload of data

Following post was very useful

http://weblogs.asp.net/jeffwids/lock-request-time-out-period-exceeded

To find sessions then

SELECT r.session_id, r.status, r.start_time, r.command, s.text,
r.wait_time, r.cpu_time, r.total_elapsed_time, r.reads, r.writes, r.logical_reads, r.transaction_isolation_level
,r.*
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) s

then Kill session id, but you cannot kill your own session, so open another session to do the kill

End.