protected virtual Action <OnCreatingContext <TObjectType, TDefinitionType> > CreateOnProvisionedHook <TObjectType, TDefinitionType>() where TDefinitionType : DefinitionBase { return(new Action <OnCreatingContext <TObjectType, TDefinitionType> >(context => { var id = context.GetType().GetGenericArguments()[0].AssemblyQualifiedName + ":" + context.ObjectDefinition.GetHashCode(); var hook = _hookMap[id]; hook.OnProvisioned = true; var farmDef = context.ObjectDefinition as FarmSolutionDefinition; if (farmDef != null && farmDef.ShouldDelete == true) { // by passing checking the object within onb provisioed event // farm solution is expected to be deleted } else { if (context.Object == null) { Console.WriteLine(""); } AssertService.IsNotNull(context.Object); AssertService.IsNotNull(context.ObjectDefinition); AssertService.IsNotNull(context.ModelHost); AssertService.IsInstanceOfType(context.Object, typeof(TObjectType)); } })); }
protected virtual Action <OnCreatingContext <TObjectType, TDefinitionType> > CreateOnProvisionedHook <TObjectType, TDefinitionType>() where TDefinitionType : DefinitionBase { return(new Action <OnCreatingContext <TObjectType, TDefinitionType> >(context => { var id = context.GetType().GetGenericArguments()[0].AssemblyQualifiedName + ":" + context.ObjectDefinition.GetHashCode(); var hook = _hookMap[id]; hook.OnProvisioned = true; AssertService.IsNotNull(context.Object); AssertService.IsNotNull(context.ObjectDefinition); AssertService.IsInstanceOfType(context.Object, typeof(TObjectType)); })); }