本文整理汇总了C#中SPSite.RequireNotNull方法的典型用法代码示例。如果您正苦于以下问题:C# SPSite.RequireNotNull方法的具体用法?C# SPSite.RequireNotNull怎么用?C# SPSite.RequireNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPSite
的用法示例。
在下文中一共展示了SPSite.RequireNotNull方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActivateFeatureIfNecessary
public static SPFeature ActivateFeatureIfNecessary(SPSite site, Guid featureGuid)
{
site.RequireNotNull("site");
featureGuid.Require(Guid.Empty != featureGuid, "featureGuid");
SPFeature feature = site.Features[featureGuid];
if (null == feature)
{
feature = site.Features.Add(featureGuid);
}
return feature;
}
示例2: AddSandboxedSolution
public static SPUserSolution AddSandboxedSolution(SPSite site, string path, string solutionName)
{
site.RequireNotNull("site");
path.RequireNotNullOrEmpty("path");
solutionName.RequireNotNullOrEmpty("solutionName");
if (!File.Exists(path))
{
throw new FileNotFoundException("File not found!", path);
}
return AddSandboxedSolution(site, File.ReadAllBytes(path), solutionName);
}
示例3: Unregister
public static void Unregister(SPSite site)
{
site.RequireNotNull("site");
elevatedPrivilegesUnRegisterTypes(site);
}
示例4: UnregisterTypes
private static void UnregisterTypes(SPSite site)
{
site.RequireNotNull("site");
LogUtility logUtility = new LogUtility();
try
{
logUtility.TraceDebugInformation("Deactivating Local utilities", typeof(ServiceLocationRegistration));
IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent();
IServiceLocatorConfig typeMappings = serviceLocator.GetInstance<IServiceLocatorConfig>();
typeMappings.Site = site;
unregisterTypeMappings(typeMappings);
logUtility.TraceDebugInformation("Successfully deactivated Local utilities", typeof(ServiceLocationRegistration));
}
catch (Exception exception)
{
logUtility.TraceDebugException("Error while deactivating Local utilities", typeof(ServiceLocationRegistration), exception);
}
finally
{
logUtility.TraceDebugInformation("Finished deactivating Local utilities", typeof(ServiceLocationRegistration));
}
}
示例5: RegisterTypes
private static void RegisterTypes(SPSite site)
{
site.RequireNotNull("site");
LogUtility logger = new LogUtility();
try
{
logger.TraceDebugInformation("Registering types for use across farms", typeof(ServiceLocationRegistration));
IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent();
IServiceLocatorConfig typeMappings = serviceLocator.GetInstance<IServiceLocatorConfig>();
typeMappings.Site = site;
registerTypeMappings(typeMappings);
}
catch (Exception exception)
{
logger.TraceDebugException("Exception while registering types!", typeof(ServiceLocationRegistration), exception);
}
finally
{
logger.TraceDebugInformation("Finished registering types for use across farms", typeof(ServiceLocationRegistration));
}
}