当前位置: 首页>>代码示例>>C#>>正文


C# SPSite.RequireNotNull方法代码示例

本文整理汇总了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;
        }
开发者ID:utdcometsoccer,项目名称:MySP2010Utilities,代码行数:13,代码来源:SharePointUtilities.cs

示例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);
 }
开发者ID:utdcometsoccer,项目名称:MySP2010Utilities,代码行数:11,代码来源:SharePointUtilities.cs

示例3: Unregister

 public static void Unregister(SPSite site)
 {
     site.RequireNotNull("site");
     elevatedPrivilegesUnRegisterTypes(site);
 }
开发者ID:utdcometsoccer,项目名称:MySP2010Utilities,代码行数:5,代码来源:ServiceLocationRegistration.cs

示例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));
            }
        }
开发者ID:utdcometsoccer,项目名称:MySP2010Utilities,代码行数:23,代码来源:ServiceLocationRegistration.cs

示例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));
     }
 }
开发者ID:utdcometsoccer,项目名称:MySP2010Utilities,代码行数:21,代码来源:ServiceLocationRegistration.cs


注:本文中的SPSite.RequireNotNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。