Wednesday, October 14, 2015
Sample Setup for Strucutremap 3+
Download Strucutremap and related packages from nugget
Install-Package StructureMap -version 3.1.6.186Install-Package StructureMap.MVC4 -version 3.0.2.115
Install-Package StructureMap.Web -version 3.1.6.186
Goto App Start Strucutremap.mvc
Replace the iniliaslizer line with this to use the Default JCDC initializer
IContainer container = StructureMapIoC.Initialize<DefaultRegistry>();
Comment out IOC.Cs in Dependency resolver
Put the following in DefaultRegistry.cs
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DefaultRegistry.cs" company="Web Advanced">
// Copyright 2012 Web Advanced (www.webadvanced.com)
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using JCDCTools.AdoAccess.BusinessObjects;
using JCDCTools.AdoAccess.Interfaces;
using JCDCTools.Core.Logging.Interfaces;
using JCDCTools.Core.User.BusinessObjects;
using JCDCTools.Core.User.Interfaces;
using JCDCTools.Core.Utilities;
using JCDCTools.Core.Utilities.BusinessObjects;
using JCDCTools.Core.Utilities.Interfaces;
using JCDCTools.NhAccess.BusinessObjects;
using JCDCTools.NhAccess.Interfaces;
using JCDCTools.Users.Bll.Interfaces;
using JCDCTools.Users.DAL.Interfaces;
using JCDCTools.Utilities.Bll.Interfaces;
using StructureMap.Pipeline;
using StructureMap.Web.Pipeline;
using TacToolsTest.BLL.Interfaces;
using TacToolsTest.DAL.Interfaces;
using TacToolsTest.Jcdc.EO;
using TacToolsTest.Jcdc.Map;
using TacToolsTest.Reporting;
namespace TACAdmin3G.DependencyResolution
{
public class DefaultRegistry : JcdcRegistry
{
#region Constructors and Destructors
public DefaultRegistry()
{
Scan(
scan =>
{
scan.AssemblyContainingType< ICenterBLL >(); // TacToolsTest BLL
scan.AssemblyContainingType< IEpmsContractsBLL >(); // TacToolsTest BLL
scan.AssemblyContainingType< ICenterDAL >(); // TacToolsTest DAL
scan.AssemblyContainingType< IWebAccess >(); // JCDCTools.Core
scan.AssemblyContainingType< IUserMaintBLL >(); // JCDCTools.Users
scan.AssemblyContainingType< IAdoHelper >(); // JcdcTools.AdoAccess
scan.AssemblyContainingType< INHFactory >(); // JcdcToools.NhAccess
scan.AssemblyContainingType<IEncryption>(); // JcdcTools.Utilities
scan.AssemblyContainingType< ISSOAuthenticationUserDataBLL >();
scan.AssemblyContainingType< ISSOAuthenticationUserDataDAL >();
scan.AssemblyContainingType< IReportGenerator >();
//scan.AssemblyContainingType<IETA640DAL>();
scan.AssemblyContainingType<IAdoHelper>();
scan.AssemblyContainingType<INetLog>();
scan.LookForRegistries();
scan.WithDefaultConventions();
});
// For<IWebAccess>().LifecycleIs<HybridLifecycle>().Use<WebAccess>().Named( "default" );
For<IWebAccess>().LifecycleIs<HybridLifecycle>().Use<WinFormAccess>().Named( "default" );
For<INetLog>()
//.LifecycleIs<HybridLifecycle>()
.Use<JCDCTools.Core.Logging.BusinessObjects.NetLog>().Singleton();
For<IAdoHelper>().Use<SybaseHelper>()
.Named( "JCDC" )
.Ctor<string>( "ConnectStringName" ).Is( "SybaseDB" )
.Ctor<string>( "TimeOutStringName" ).Is( "SybaseDBCommandTimeout" );
For<IAdoHelper>().Use<SybaseHelper>()
.Named( "SPAMIS" )
.Ctor<string>( "ConnectStringName" ).Is( "SpamisDB" )
.Ctor<string>( "TimeOutStringName" ).Is( "SybaseDBCommandTimeout" );
For<IUser>()
.LifecycleIs<HybridLifecycle>()
.Use<UserByMock>();
For<INHFactory>().Use<NHFactory>()
.Named( "JCDC" )
.LifecycleIs<SingletonLifecycle>()
.Singleton();
For<INHSession>().Use<NHSession>()
.Named( "JCDC" )
.LifecycleIs<HybridLifecycle>()
.Ctor<string>( "ConnectStringName" ).Is( "XXXXX" )
.Ctor<string>( "TimeOutStringName" ).Is( "SybaseDBCommandTimeout" )
.Ctor<string>( "DBNameAndHasTran " ).Is( "XXXXX" );
For<INHFactory>().Use<NHFactory>()
.Named( "JCDC_HasTrans" )
.LifecycleIs<SingletonLifecycle>()
.Singleton();
For<INHSession>().Use<NHSession>()
.Named( "JCDC_HasTrans" )
.LifecycleIs<HybridLifecycle>()
.Ctor<string>( "ConnectStringName" ).Is( "XXX" )
.Ctor<string>( "TimeOutStringName" ).Is( "SybaseDBCommandTimeout" )
.Ctor<string>( "DBNameAndHasTran " ).Is( "XX" );
For<INHFactory>().Use<NHFactory>()
.Named( "JCDC_HasNoTrans" )
.LifecycleIs<SingletonLifecycle>()
.Singleton();
For<INHSession>().Use<NHSession>()
.Named( "JCDC_HasNoTrans" )
.LifecycleIs<HybridLifecycle>()
.Ctor<string>( "ConnectStringName" ).Is( "SybaseDB" )
.Ctor<string>( "TimeOutStringName" ).Is( "SybaseDBCommandTimeout" )
.Ctor<string>( "DBNameAndHasTran " ).Is( "JCDC_HasTrans" );
For<INHFactory>().Use<NHFactory>()
.Named( "SPAMIS_HasTrans" )
.LifecycleIs<SingletonLifecycle>()
.Singleton();
For<INHSession>().Use<NHSession>()
.Named( "SPAMIS_HasTrans" )
.LifecycleIs<HybridLifecycle>()
.Ctor<string>( "ConnectStringName" ).Is( "XXXXX" )
.Ctor<string>( "TimeOutStringName" ).Is( "SybaseDBCommandTimeout" )
.Ctor<string>( "DBNameAndHasTran " ).Is( "XXXXXX" );
}
/// <summary>
/// Initializes the objects after the Structuremap configure method has finished, this is because only then can you get objects from the container - EWB.
/// </summary>
/// <Programmer>Brown.ericw</Programmer>
/// <CreateDate>10/7/2015-11:46 AM</CreateDate>
public override void InitObjectsPostConfigure()
{
INHFactory jcdcFactory;
jcdcFactory = JcdcObjectFactory.GetNamedInstance<INHFactory>( "XXXXX" );
jcdcFactory.BuildFactoryByConfigFile<StudentEO, StudentEOMap>( "~/XXXXX.config" );
jcdcFactory = JcdcObjectFactory.GetNamedInstance<INHFactory>( "XXXXX_HasTrans" );
jcdcFactory.BuildFactoryByConfigFile<StudentEO, StudentEOMap>( "~/XXXXX.config" );
jcdcFactory = JcdcObjectFactory.GetNamedInstance<INHFactory>( "XXXXX_HasNoTrans" );
jcdcFactory.BuildFactoryByConfigFile<StudentEO, StudentEOMap>( "~/XXXXXb.config" );
}
#endregion
}
}
Wednesday, April 22, 2015
Chrome Debugger, setting breakpoints in angularjs
So, If you are like me and you live with the debugger, even in JQuery, Amglar is going to throw you for aloop... because chrome's debuggers breakpoints dont' work..
And you you get the BAtarang tool for "debugging" angular... it's aparent pretty quickly, that i'ts not debugging in a debugger, but something else entlirely...
I'ts like going back to the 1990s when Programemrs would decalre pridefuly "only bad programemrs need to use a debugger"
Fortunately there is a way to get a break point.. stepping through code is harder but if you drop the keyword 'debugger;' into you code, it will force a break point when that anglyuar function is called.
$scope.SaveScript = function () {
debugger;// it will break here
if (($scope.selectedLanguage == -1) || ($scope.selectedCallscript == -1)) {
return;
} else {
var ckData = CKEDITOR.instances.CkEditorId.getData();
var dataToSend = TestService1.BuildSaveScriptCV(ckData, $scope.selectedLanguage, $scope.selectedCallscript, "test tile");
var linkUrl = 'http://localhost/Scout3G/Maintenance/SaveScript';
//var linkUrl = '@Url.Action("SaveScript","Maintenance")';
TestService1.JcdcAjaxDoPostRetrieveJson1(linkUrl, $scope.DisplaySavedScript, dataToSend);
}
};
it's not beautiful, but at least you can tell if a function is gettign called without resoritng to cave man debugging with Alerts.
useful links in debuging angluarjs
http://24days.in/umbraco/2014/debugging-angularjs/
http://ng-inspector.org/
http://stackoverflow.com/questions/18782069/how-to-debug-angular-javascript-code
https://chrome.google.com/webstore/detail/angularjs-batarang-stable/niopocochgahfkiccpjmmpchncjoapek?hl=en-US
http://odetocode.com/blogs/scott/archive/2014/07/29/debugging-angularjs-in-the-console.aspx
Thursday, April 16, 2015
VS2013 MVC4 project as soon as you add json.net package you cant' compile
As soon as you add the Json>net package in nut get on a new blank mvc 4 applicaiton project, you get this
Server Error in '/' Application.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Source File: c:\Users\Brown.ericw\Documents\Visual Studio 2013\Projects\AngularTest4\AngularTest4\Global.asax.cs Line: 19
This is the fix
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.8.0" newVersion="6.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
The key is that the version on the package is 6.0.8 and you think that's what you are supposed to use , but nope, it 6.0.0.0
Server Error in '/' Application.
Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
|
Source File: c:\Users\Brown.ericw\Documents\Visual Studio 2013\Projects\AngularTest4\AngularTest4\Global.asax.cs Line: 19
This is the fix
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.8.0" newVersion="6.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
The key is that the version on the package is 6.0.8 and you think that's what you are supposed to use , but nope, it 6.0.0.0
Friday, February 20, 2015
TFS Tricks to remember
A few things I learned about TFS painfully this week.
1. TFS in VS2013 logs to the output window, it logs important things that you'd expect it to popup in warning dialogs, so watch the window.
2. TFS will not do a get latest if the files have pending adds... It just skips them and logs it in the output window.
3. To force a get all, you have to go to the get specific version and check both the check boxes, get selected version is not available in the obvious way, you have to dig for it
Go to Source control window,
Click on rot folder (i.e. solution folder) you want to do the get from
Right click,
Choose Get Specific Version
Check both overwrite check boxes
This is the equivalent of a get with force all in StarTeam.
Subscribe to:
Posts (Atom)