Exemplo n.º 1
0
 protected override void Initialize(HttpControllerContext controllerContext)
 {
     base.Initialize(controllerContext);
     // Note that the SxcInstance is created by the BaseClass, if it's detectable. Otherwise it's null
     DnnAppAndDataHelpers = new DnnAppAndDataHelpers(SxcInstance, SxcInstance?.Log ?? Log);
     controllerContext.Request.Properties.Add(Constants.DnnContextKey, Dnn); // must run after creating AppAndDataHelpers
 }
Exemplo n.º 2
0
 public dynamic CreateInstance(string virtualPath,
                               string dontRelyOnParameterOrder = Eav.Constants.RandomProtectionParameter,
                               string name         = null,
                               string relativePath = null,
                               bool throwOnError   = true) =>
 DnnAppAndDataHelpers.CreateInstance(virtualPath, dontRelyOnParameterOrder, name,
                                     SharedCodeVirtualRoot, throwOnError);
Exemplo n.º 3
0
 protected override void Initialize(HttpControllerContext controllerContext)
 {
     base.Initialize(controllerContext);
     Log.Rename("2sApiC");
     SxcInstance          = Helpers.GetSxcOfApiRequest(Request, true, Log);
     DnnAppAndDataHelpers = new DnnAppAndDataHelpers(SxcInstance, SxcInstance?.EnvInstance, SxcInstance?.Log ?? Log);
     controllerContext.Request.Properties.Add(Constants.DnnContextKey, Dnn); // must run after creating AppAndDataHelpers
 }
Exemplo n.º 4
0
        /// <summary>
        /// Creates instances of the shared pages with the given relative path
        /// </summary>
        /// <returns></returns>
        public dynamic CreateInstance(string virtualPath,
                                      string dontRelyOnParameterOrder = Eav.Constants.RandomProtectionParameter,
                                      string name         = null,
                                      string relativePath = null,
                                      bool throwOnError   = true)
        {
            var path = NormalizePath(virtualPath);

            VerifyFileExists(path);
            return(path.EndsWith(CodeCompiler.CsFileExtension)
                ? DnnAppAndDataHelpers.CreateInstance(path, dontRelyOnParameterOrder, name, null, throwOnError)
                : CreateInstanceCshtml(path));
        }
Exemplo n.º 5
0
        protected override void ConfigurePage(WebPageBase parentPage)
        {
            base.ConfigurePage(parentPage);

            // Child pages need to get their context from the Parent
            Context = parentPage.Context;

            // Return if parent page is not a SexyContentWebPage
            if (!(parentPage is SexyContentWebPage typedParent))
            {
                return;
            }

            Html = typedParent.Html;
            Url  = typedParent.Url;
            Sexy = typedParent.Sexy;
            DnnAppAndDataHelpers = typedParent.DnnAppAndDataHelpers;
        }
Exemplo n.º 6
0
        protected override void Initialize(HttpControllerContext controllerContext)
        {
            base.Initialize(controllerContext);
            // Note that the SxcInstance is created by the BaseClass, if it's detectable. Otherwise it's null
            DnnAppAndDataHelpers = new DnnAppAndDataHelpers(SxcInstance, SxcInstance?.Log ?? Log);

            // In case SxcInstance was null, there is no instance, but we may still need the app
            if (DnnAppAndDataHelpers.App == null)
            {
                TryToAttachAppFromUrlParams();
            }

            // must run this after creating AppAndDataHelpers
            controllerContext.Request.Properties.Add(Constants.DnnContextKey, Dnn);

            if (controllerContext.Request.Properties.TryGetValue(CodeCompiler.SharedCodeRootPathKeyInCache, out var value))
            {
                SharedCodeVirtualRoot = value as string;
            }
        }
Exemplo n.º 7
0
        // </2sic>


        #endregion

        #region BaseClass Overrides

        protected override void ConfigurePage(WebPageBase parentPage)
        {
            base.ConfigurePage(parentPage);

            // Child pages need to get their context from the Parent
            Context = parentPage.Context;

            // Return if parent page is not a SexyContentWebPage
            if (!(parentPage is SexyContentWebPage typedParent))
            {
                return;
            }

            Html = typedParent.Html;
            // Deprecated 2019-05-27 2dm - I'm very sure this isn't used anywhere or by anyone.
            // reactivate if it turns out to be used, otherwise delete ca. EOY 2019
            //Url = typedParent.Url;
            Sexy = typedParent.Sexy;
            DnnAppAndDataHelpers = typedParent.DnnAppAndDataHelpers;
        }
Exemplo n.º 8
0
        // </2sic>

        #endregion

        #region BaseClass Overrides

        protected override void ConfigurePage(WebPageBase parentPage)
        {
            base.ConfigurePage(parentPage);

            // Child pages need to get their context from the Parent
            Context = parentPage.Context;

            // Return if parent page is not a SexyContentWebPage

            // 2016-05-02 if (!(parentPage is SexyContentWebPage)) return;    // 2016-02-22 believe this is necessary with dnn 8 because this razor uses a more complex inheritance with Type<T>
            //if (parentPage.GetType().BaseType != typeof(SexyContentWebPage)) return;

            var typedParent = parentPage as SexyContentWebPage;

            if (typedParent == null)
            {
                return;
            }

            Html = typedParent.Html;
            Url  = typedParent.Url;
            Sexy = typedParent.Sexy;
            DnnAppAndDataHelpers = typedParent.DnnAppAndDataHelpers;
        }
Exemplo n.º 9
0
 /// <inheritdoc />
 public T CreateSource <T>(IDataStream inStream) => DnnAppAndDataHelpers.CreateSource <T>(inStream);
Exemplo n.º 10
0
 /// <inheritdoc />
 public IEntity AsEntity(dynamic dynamicEntity) => DnnAppAndDataHelpers.AsEntity(dynamicEntity);
Exemplo n.º 11
0
 /// <inheritdoc />
 public IEnumerable <dynamic> AsDynamic(IDataStream stream) => DnnAppAndDataHelpers.AsDynamic(stream.List);
Exemplo n.º 12
0
 /// <inheritdoc />
 public dynamic AsDynamic(KeyValuePair <int, IEntity> entityKeyValuePair) => DnnAppAndDataHelpers.AsDynamic(entityKeyValuePair.Value);
Exemplo n.º 13
0
 /// <inheritdoc />
 public dynamic AsDynamic(dynamic dynamicEntity) => DnnAppAndDataHelpers.AsDynamic(dynamicEntity);
Exemplo n.º 14
0
 /// <summary>
 /// Provides an Adam instance for this item and field
 /// </summary>
 /// <param name="entity">The entity, often Content or similar</param>
 /// <param name="fieldName">The field name, like "Gallery" or "Pics"</param>
 /// <returns>An Adam object for navigating the assets</returns>
 public FolderOfField AsAdam(IEntity entity, string fieldName) => DnnAppAndDataHelpers.AsAdam(entity, fieldName);
Exemplo n.º 15
0
 /// <summary>
 /// Provides an Adam instance for this item and field
 /// </summary>
 /// <param name="entity">The entity, often Content or similar</param>
 /// <param name="fieldName">The field name, like "Gallery" or "Pics"</param>
 /// <returns>An Adam object for navigating the assets</returns>
 public FolderOfField AsAdam(DynamicEntity entity, string fieldName)
 => DnnAppAndDataHelpers.AsAdam(AsEntity(entity), fieldName);
Exemplo n.º 16
0
 public T CreateSource <T>(IDataSource inSource = null, IValueCollectionProvider configurationProvider = null)
 => DnnAppAndDataHelpers.CreateSource <T>(inSource, configurationProvider);
Exemplo n.º 17
0
 public IDataSource CreateSource(string typeName = "", IDataSource inSource = null,
                                 IValueCollectionProvider configurationProvider = null)
 => DnnAppAndDataHelpers.CreateSource(typeName, inSource, configurationProvider);
Exemplo n.º 18
0
 /// <inheritdoc />
 public IEnumerable <dynamic> AsDynamic(IEnumerable <IEntity> entities) => DnnAppAndDataHelpers.AsDynamic(entities);