Wednesday, March 12, 2014

Update a DLL in GAC in a Windows 2012 server

Since .net framework 4.0, the gacutil location has been changed and in a windows sdk folder.
However, on a SharePoint 2013 production box, the windows SDK is not installed.
Here is the Powershell come to rescue.

[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

$publish = New-Object System.EnterpriseServices.Internal.Publish

$publish.GacInstall("...you dll path");



 

Monday, January 6, 2014

Tip to debug localhost with fiddler

If you need to debug the http request/response for the localhost,
you can send to http://ipv4.fiddler/folder instead of Http://localhost/folder
port number also works.

Monday, December 23, 2013

Rebind AngularJS in ajax call

Just a quick tip when I am trying to working on the angular with jquery ajax.

After the data is assigned in an ajax call back function, angular won't be able to monitor change,
in this case, $scope.$apply() will be needed to reflect data binding.

Thursday, December 19, 2013

SharePoint 2013 TypeLoadException Error when set up BDC

If you set up the BDC model and you may get an error in ULS log as below,


The Type name for the Secure Store provider is not valid. ---> System.TypeLoadException: Could not load type 'Secure Store Service' from assembly 'Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. 
InnerException 1: System.TypeLoadException: Could not load type 'Secure Store Service' from assembly 'Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.   


The reason is that in the BDC service application, its external system instance not set up correctly for the property "secure store implementation", when the instance is created it is blank, not like SharePoint 2010 the value is pre-populated, so naturally by the name definition, I put in the secure store service proxy name such as "Secure Store Provider".

This is wrong, what we should put is the type name as below,
Microsoft.Office.SecureStoreService.Server.SecureStoreProvider, Microsoft.Office.SecureStoreService, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c

Then it worked.

Monday, October 14, 2013

Good Links for Entity Framework Code first design and relationsahip association

Just read the next two blogs which are really useful in design domain driven model with EF code first, and worth noting here as reference in my daily dev work life.

This msdn series article discussed how to build a real model in DDD and the pitfalls in a traditional database mapping view.
http://msdn.microsoft.com/en-us/magazine/dn451438.aspx

This blog has clearly explained the relationships in using entity framwork code first.
http://weblogs.asp.net/manavi/archive/tags/C_2300_/default.aspx

Wednesday, October 2, 2013

Using external list to building screens for users to CRUD and adding search filters

When the external content type is created, the filters can be added in the read list operation. If you create a site page and add the Business Data List web part, the filters will be shown automatically for users to be able to search. However, the search functions created are really hard to use. The below article show a step by step guide to build a custom filter screen on top of the list web part, which can be customized and easier to use.

http://arsalkhatri.wordpress.com/2012/01/07/external-list-with-bcs-search-filters-finders/

Also many times users will want to be able to just press enter to be able to search, so I added the key press event for the button as well,

  var body = document.getElementsByTagName('body')[0];
  body.onkeydown = function (e) {
        if (window.event.keyCode === 13) { 
ApplySearchFilters();
        }
  }

And when I tried to add the wild search for a field which is not null in database, do not use Ignore filter if Value is Null. Instead, just check the Custom value radio button, it will work.

For all other fields with nullable fields, Null is fine.






Thursday, September 26, 2013

SharePoint slow to start up after application pool recycled

After deploy solution through visual studio the application pool will be recycled.
Then it is painful slow to start the first page.

There are a few articles talking about this,
http://blog.muhimbi.com/2009/04/new-approach-to-solve-sharepoints.html
http://ddkonline.blogspot.com.au/2010/05/fix-sharepoint-very-slow-to-start-after.html

I just execute the vb script below as the article discussed to add the registry settings, without reboot the server, and it worked much faster.

const HKEY_USERS = &H80000003
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = ""
objReg.EnumKey HKEY_USERS, strKeyPath, arrSubKeys
strKeyPath = "\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing"
For Each subkey In arrSubKeys    
objReg.SetDWORDValue HKEY_USERS, subkey & strKeyPath, "State", 146944
Next