Exemple #1
0
    /// <summary>
    /// 检测当前buff中的数据, 如果数据符合Detach条件返回true
    /// TODO 检测效率
    /// </summary>
    /// <returns>是否符合Detach条件</returns>
    public bool CheckDetach()
    {
        var result = false;

        // 检测条件
        for (var i = 0; i < DetachQualifiedKeyList.Count; i++)
        {
            var key   = DetachQualifiedKeyList[i];
            var op    = DetachQualifiedOptionList[i];
            var value = DetachQualifiedValueList[i];
            // 判断类型
            if (value.IndexOf("f", StringComparison.Ordinal) > 0)
            {
                // float
                result = Utils.GetCompare <float>(op)(DataScope.GetFloat(key).Value, Convert.ToSingle(value.Replace("f", "")));
            }
            else if (value.EndsWith("L"))
            {
                // long
                result = Utils.GetCompare <long>(op)(DataScope.GetLong(key).Value, Convert.ToInt64(value));
            }
            else if (value.Equals("true") && value.Equals("false"))
            {
                // bool
                result = Utils.GetCompare <bool>(op)(DataScope.GetBool(key).Value, Convert.ToBoolean(value));
            }
            else
            {
                // int
                result = Utils.GetCompare <int>(op)(DataScope.GetInt(key).Value, Convert.ToInt32(value));
            }
        }

        return(result);
    }
 public DownloadCampaignsByCampaignIdsResponse TryDownloadCampaignsByCampaignIds(
     ApiAuthentication auth,
     CampaignScope[] campaigns,
     long accountId,
     long?customerId,
     DataScope dataScope,
     BulkDownloadEntity entities,
     CompressionType compressionType   = CompressionType.Zip,
     DownloadFileType downloadFileType = DownloadFileType.Tsv,
     string formatVersion       = "4.0",
     DateTime?lastSyncTimeInUTC = null,
     DateTime?start             = null,
     DateTime?end = null)
 {
     return(MethodHelper.TryGet(DownloadCampaignsByCampaignIds, this,
                                auth,
                                campaigns,
                                accountId,
                                customerId,
                                dataScope,
                                entities,
                                compressionType,
                                downloadFileType,
                                formatVersion,
                                lastSyncTimeInUTC,
                                start,
                                end));
 }
        /// <summary>
        /// Documentation pending
        /// </summary>
        /// <param name="scope"></param>
        /// <param name="locale"></param>
        public DataConnectionImplementation(PublicationScope scope, CultureInfo locale)
        {
            InitializeThreadData();
            InitializeScope(scope, locale);

            _dataScope = new DataScope(this.DataScopeIdentifier, locale);
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            // Get the name of the function to execute by copying the current file name
            // (without the .ashx extension)
            string functionName = Path.GetFileNameWithoutExtension(context.Request.Path);
            // Locate the data culture to use - like en-US or nl-NL
            CultureInfo dataCulture = GetCurrentDataCulture(context);

            using (DataScope dataScope = new DataScope(DataScopeIdentifier.Public, dataCulture))
            {
                // Grab a function object to execute
                IFunction function = FunctionFacade.GetFunction(functionName);

                // Execute the function, passing all query string parameters as input parameters
                object functionResult = FunctionFacade.Execute <object>(function, context.Request.QueryString);

                // output result
                if (functionResult != null)
                {
                    context.Response.Write(functionResult.ToString());
                    if (functionResult is XNode && function.ReturnType != typeof(Composite.Core.Xml.XhtmlDocument))
                    {
                        context.Response.ContentType = "text/xml";
                    }
                }
            }
        }
Exemple #5
0
        private void step1CodeActivity_InitializeBindings_ExecuteCode(object sender, EventArgs e)
        {
            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();

            Type interfaceType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);

            List <CultureInfo> culturesWithData = new List <CultureInfo>();

            foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)
            {
                using (DataScope localeScope = new DataScope(cultureInfo))
                {
                    bool dataExists = DataFacade.GetData(interfaceType).ToDataEnumerable().Any();

                    if (dataExists)
                    {
                        culturesWithData.Add(cultureInfo);
                    }
                }
            }

            Dictionary <string, string> culturesDictionary = culturesWithData.ToDictionary(f => f.Name, DataLocalizationFacade.GetCultureTitle);

            this.Bindings.Add("CultureName", culturesDictionary.First().Key);
            this.Bindings.Add("CultureNameList", culturesDictionary);
        }
Exemple #6
0
        public ApplicationDataSettings <T> Settings <T>(
            string key, bool isProtected, string[] subFolders = null, DataScope scope = DataScope.CurrentUser)
        {
            var applicationData = new ApplicationData(this, scope, subFolders);

            key = DataSettingsKey.KeyOrTypeName <T>(key);

            var fullKey = DataSettingsKey.GetFullPath(applicationData, key);

            ApplicationDataSettings <T> applicationDataSettings;

            if (settingsDictionary.ContainsKey(fullKey))
            {
                applicationDataSettings = (ApplicationDataSettings <T>)settingsDictionary[fullKey];

                var fullKeyWithExtension = DataSettingsKey.GetFullPathWithExtension(applicationData, key, isProtected);

                if (!applicationDataSettings.Configuration.Path.Equals(fullKeyWithExtension))
                {
                    var message = string.Format("Cannot change the ApplicationDataSettings with key {0} if already exists.", key);

                    throw new InvalidOperationException(message);
                }

                return(applicationDataSettings);
            }

            applicationDataSettings = applicationData.Settings <T>(isProtected, key);

            return(applicationDataSettings);
        }
Exemple #7
0
 public void ApplyGenerators(object entity, DataScope scope)
 {
     foreach (GeneratorAspectMember member in this)
     {
         member.ApplyTo(entity, scope);
     }
 }
            public void AuthorizeRequest(object sender, EventArgs e)
            {
                if (!SystemSetupFacade.IsSystemFirstTimeInitialized)
                {
                    return;
                }

                HttpApplication application = (HttpApplication)sender;
                HttpContext     context     = application.Context;

                bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context);

                if (adminRootRequest && UserValidationFacade.IsLoggedIn())
                {
                    _dataScope = new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo);

                    if (!_consoleArtifactsInitialized)
                    {
                        lock (_consoleArtifactsInitializeLock)
                        {
                            if (!_consoleArtifactsInitialized && !SystemSetupFacade.SetupIsRunning)
                            {
                                HookingFacade.EnsureInitialization();
                                FlowControllerFacade.Initialize();
                                ConsoleFacade.Initialize();
                                ElementProviderLoader.LoadAllProviders();
                                _consoleArtifactsInitialized = true;
                            }
                        }
                    }
                }
            }
    protected void Page_Load(object sender, EventArgs e)
    {
        using (DataScope dataScope = new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo))
        {
            XElement infoDocumentRoot = new XElement("ActionItems");

            if (Request.QueryString["showpagedata"] == "true")
            {
                AttachPageElements(infoDocumentRoot);
            }
            if (Request.QueryString["showglobaldata"] == "true")
            {
                AttachGlobalDataElements(infoDocumentRoot);
            }

            if (infoDocumentRoot.Elements().Any() == true)
            {
                XDocument newTree = TransformMarkup(infoDocumentRoot);

                visualOutput.Controls.Add(new LiteralControl(newTree.ToString()));
            }
            else
            {
                emptyLabelPlaheHolder.Visible = true;
            }
        }
    }
        public void ProcessRequest(HttpContext context)
        {
            var functionName = (string)context.Request.RequestContext.RouteData.Values["function"];

            var dataCulture = GetCurrentDataCulture(context);

            using (var data = new DataConnection())
            {
                if (!data.Get <IFunctionRoute>().Any())
                {
                    context.Response.StatusCode = (int)HttpStatusCode.NotFound;

                    return;
                }
            }

            IFunction function;

            if (!FunctionFacade.TryGetFunction(out function, functionName))
            {
                context.Response.StatusCode = (int)HttpStatusCode.NotFound;

                return;
            }

            using (var dataScope = new DataScope(DataScopeIdentifier.Public, dataCulture))
            {
                var functionResult = FunctionFacade.Execute <object>(function, context.Request.QueryString);
                if (functionResult == null)
                {
                    context.Response.StatusCode = (int)HttpStatusCode.BadRequest;

                    return;
                }

                var xhtmlDocument = functionResult as XhtmlDocument;
                if (xhtmlDocument != null)
                {
                    PageRenderer.ExecuteEmbeddedFunctions(xhtmlDocument.Root, new FunctionContextContainer());
                    PageRenderer.NormalizeXhtmlDocument(xhtmlDocument);

                    var xhtml = xhtmlDocument.ToString();

                    xhtml = PageUrlHelper.ChangeRenderingPageUrlsToPublic(functionResult.ToString());
                    xhtml = MediaUrlHelper.ChangeInternalMediaUrlsToPublic(xhtml);

                    context.Response.Write(xhtml);
                }
                else
                {
                    context.Response.Write(functionResult.ToString());

                    if (functionResult is XNode && function.ReturnType != typeof(XhtmlDocument))
                    {
                        context.Response.ContentType = "text/xml";
                    }
                }
            }
        }
Exemple #11
0
        public RuleManager(DataScope dataScope)
        {
            _dataScope = dataScope;

            OnReload();

            RuleDao.Instance.OnReload(OnReload);
        }
 public void OutputDataScope(DataScope valueSet)
 {
     OutputStatusMessage(string.Format("Values in {0}", valueSet.GetType()));
     foreach (var value in Enum.GetValues(typeof(DataScope)))
     {
         OutputStatusMessage(value.ToString());
     }
 }
Exemple #13
0
 public MenuDataItem(SecPageEntity page, MenuDataItem parentMenu,DataScope pageScope)
 {
     ParentMenu = parentMenu;
     Page = page;
     SubMenu = new List<MenuDataItem>();
     ValidControls = new List<SecPermissionEntity>();
     PageScope = pageScope;
 }
Exemple #14
0
        public static void Save(DataScope dataScope, string groupName, Rule rule)
        {
            Group group = RuleDao.Instance.GetGroupByName(groupName);

            group.rules.Add(rule);

            Save(dataScope, group);
        }
        public override void Dispose()
        {
            base.Dispose();

            m_Context = null;

            m_DataScope.Dispose();
            m_DataScope = null;
        }
 public void ApplyTo(object entity, DataScope scope)
 {
     if (scope == _generator.GeneratorScope || _generator.GeneratorScope == DataScope.Save)
     {
         object value = GetValue(entity);
         if (ValidationHelper.IsNullOrEmpty(value))
             SetValue(entity, _generator.Generate());
     }
 }
Exemple #17
0
        public static void Delete(DataScope dataScope, string groupKey, string ruleKey)
        {
            Group group       = RuleDao.Instance.GetGroup(groupKey);
            Rule  toBeRemoved = group.rules.FirstOrDefault(rule => rule.key == ruleKey);

            group.rules.Remove(toBeRemoved);

            Delete(dataScope, groupKey);
            Save(dataScope, group);
        }
Exemple #18
0
 static void Main(string[] args)
 {
     using (var ss = new DataScope(@"connString"))
     {
         var db  = DataScope.DatabaseConnection;
         var pk  = 2;
         var sql = db.Beats.AsQueryable();
         sql = sql.Where(PKGreaterThan(pk));
         var res = sql.ToList();
     }
 }
 public void ApplyTo(object entity, DataScope scope)
 {
     if (scope == _generator.GeneratorScope || _generator.GeneratorScope == DataScope.Save)
     {
         object value = GetValue(entity);
         if (ValidationHelper.IsNullOrEmpty(value))
         {
             SetValue(entity, _generator.Generate());
         }
     }
 }
Exemple #20
0
        public static void Delete(DataScope dataScope, string groupKey)
        {
            string fileName = groupKey + ".json";
            string path     = dataScope == DataScope.Local
                ? JqaPaths.Instance.BuildLocalRulesPath()
                : JqaPaths.Instance.BuildGlobalRulesPath();

            File.Delete(Path.Combine(path, fileName));

            RuleDao.Instance.ReloadAll();
        }
Exemple #21
0
        public void Pack(PackageCreator creator)
        {
            if (Id == _pagesName)
            {
                #region All Pages
                HashSet <Guid> pages;
                using (var scope = new DataScope(DataScopeIdentifier.Administrated))
                {
                    pages = DataFacade.GetData <IPage>().Select(p => p.Id).ToHashSet();
                }

                creator.AddData(typeof(IPage), DataScopeIdentifier.Public, d => pages.Contains((d as IPage).Id));
                creator.AddData(typeof(IPage), DataScopeIdentifier.Administrated, d => pages.Contains((d as IPage).Id));
                creator.AddData(typeof(IPagePlaceholderContent), DataScopeIdentifier.Public, d => pages.Contains((d as IPagePlaceholderContent).PageId));
                creator.AddData(typeof(IPagePlaceholderContent), DataScopeIdentifier.Administrated, d => pages.Contains((d as IPagePlaceholderContent).PageId));
                creator.AddData(typeof(IPageStructure), DataScopeIdentifier.Public, d => pages.Contains((d as IPageStructure).Id));
                #endregion
            }
            else if (Id == _mediasName)
            {
                creator.AddData(typeof(IMediaFileData));
                creator.AddData(typeof(IMediaFolderData));
                creator.AddFilesInDirectory(@"App_Data\Media\");
            }
            else if (Id == _datatypesName)
            {
                IEnumerable <Type> pageDataTypeInterfaces = PageFolderFacade.GetAllFolderTypes();
                IEnumerable <Type> pageMetaTypeInterfaces = PageMetaDataFacade.GetAllMetaDataTypes();

                foreach (var pageDataType in pageDataTypeInterfaces)
                {
                    creator.AddDataTypeData(pageDataType);
                }
                foreach (var pageMetaType in pageMetaTypeInterfaces)
                {
                    creator.AddDataTypeData(pageMetaType);
                }
            }
            else if (Id == _applicationsName)
            {
                creator.AddData <IDataItemTreeAttachmentPoint>();
            }
            else if (Id == _metatypesName)
            {
                IEnumerable <Type> pageMetaTypeInterfaces = PageMetaDataFacade.GetAllMetaDataTypes();

                foreach (var pageMetaType in pageMetaTypeInterfaces)
                {
                    creator.AddDataTypeData(pageMetaType);
                }
            }
            return;
        }
Exemple #22
0
        public static void Open(DataScope dataScope, Group group = null)
        {
            string title = BuildTitle(group);

            CqaGroupEditWindow cqaGroupEditWindow =
                GetWindow <CqaGroupEditWindow>(true, title);

            cqaGroupEditWindow.maxSize = new Vector2(300, 420);
            cqaGroupEditWindow.minSize = new Vector2(300, 420);

            cqaGroupEditWindow.Init(dataScope, title, group);
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Permission;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.Permission.PermissionStatus>)StatusElement.DeepCopy();
            }
            if (Intent != null)
            {
                dest.Intent = (Hl7.Fhir.Model.CodeableConcept)Intent.DeepCopy();
            }
            if (Asserter != null)
            {
                dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopy();
            }
            if (AssertionDateElement != null)
            {
                dest.AssertionDateElement = new List <Hl7.Fhir.Model.FhirDateTime>(AssertionDateElement.DeepCopy());
            }
            if (Validity != null)
            {
                dest.Validity = (Hl7.Fhir.Model.Period)Validity.DeepCopy();
            }
            if (Purpose != null)
            {
                dest.Purpose = new List <Hl7.Fhir.Model.CodeableConcept>(Purpose.DeepCopy());
            }
            if (DataScope != null)
            {
                dest.DataScope = new List <Hl7.Fhir.Model.Expression>(DataScope.DeepCopy());
            }
            if (ProcessingActivity != null)
            {
                dest.ProcessingActivity = new List <Hl7.Fhir.Model.Permission.ProcessingActivityComponent>(ProcessingActivity.DeepCopy());
            }
            if (Justification != null)
            {
                dest.Justification = (Hl7.Fhir.Model.Permission.JustificationComponent)Justification.DeepCopy();
            }
            if (UsageLimitations != null)
            {
                dest.UsageLimitations = new List <Hl7.Fhir.Model.CodeableConcept>(UsageLimitations.DeepCopy());
            }
            return(dest);
        }
 public bool IncludeInScope(DataScope scope)
 {
     if (this._Generator == null)
     {
         return(true);
     }
     else if (this._Generator.GeneratorScope == DataScope.Save)
     {
         return(true);
     }
     else
     {
         return(this._Generator.GeneratorScope == scope);
     }
 }
        public static void Open(DataScope dataScope, Group group = null, Rule rule = null)
        {
            string dialogTitle = BuildTitle(rule);

            CqaRuleEditWindow cqaRuleEditWindow =
                GetWindow <CqaRuleEditWindow>(true, dialogTitle);

            cqaRuleEditWindow.minSize     = new Vector2(500, 700);
            cqaRuleEditWindow.DialogTitle = dialogTitle;
            cqaRuleEditWindow.OldRule     = rule;
            cqaRuleEditWindow.OldGroup    = group;
            cqaRuleEditWindow.DataScope   = dataScope;

            cqaRuleEditWindow.InitializeForm();
        }
Exemple #26
0
        private static bool ExistsInOtherLocale(IPage page)
        {
            foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures.Except(new CultureInfo[] { page.DataSourceId.LocaleScope }))
            {
                using (DataScope dataScope = new DataScope(cultureInfo))
                {
                    bool exists = DataFacade.GetData <IPage>(f => f.Id == page.Id).Any();
                    if (exists)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemple #27
0
        private void Init(DataScope dataScope, string dialogTitle, Group group)
        {
            DataScope   = dataScope;
            DialogTitle = dialogTitle;
            OldGroup    = group;

            InitializeForm();

            if (group != null)
            {
                _keyStringFormGroup.Autofill(group.key);
                _nameStringFormGroup.Autofill(group.name);
            }

            _scopeEnumFormGroup.Autofill(dataScope);
        }
Exemple #28
0
            public void AuthenticateRequest(object sender, EventArgs e)
            {
                if (SystemSetupFacade.IsSystemFirstTimeInitialized == false)
                {
                    return;
                }

                HttpApplication application = (HttpApplication)sender;
                HttpContext     context     = application.Context;

                bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context);

                if (adminRootRequest && UserValidationFacade.IsLoggedIn())
                {
                    _dataScope = new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo);
                }
            }
Exemple #29
0
    static int set_DataScope(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            AbilityBase obj  = (AbilityBase)o;
            DataScope   arg0 = (DataScope)ToLua.CheckObject(L, 2, typeof(DataScope));
            obj.DataScope = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index DataScope on a nil value" : e.Message));
        }
    }
Exemple #30
0
    static int get_DataScope(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            AbilityBase obj = (AbilityBase)o;
            DataScope   ret = obj.DataScope;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index DataScope on a nil value" : e.Message));
        }
    }
        //Classic Switch
        Scope ClassicFromDataScopeToScope(DataScope dataScope)
        {
            switch (dataScope)
            {
            case DataScope.Business:
                return(Scope.Business);

            case DataScope.PrivateLease:
                return(Scope.PrivateLease);

            case DataScope.ShortLease:
                return(Scope.ShortLease);

            default:
                return(Scope.Undefined);
            }
        }
        private static void AuthenticateRequest(object sender, EventArgs e)
        {
            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)
            {
                return;
            }

            HttpContext context = ((HttpApplication)sender).Context;

            bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context);

            if (adminRootRequest && UserValidationFacade.IsLoggedIn())
            {
                var dataScope = new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo);
                context.Items[HttpContextItemsKey] = dataScope;
            }
        }
 public bool IncludeInScope(DataScope scope)
 {
     if (this._Generator == null)
         return true;
     else if (this._Generator.GeneratorScope == DataScope.Save)
         return true;
     else return this._Generator.GeneratorScope == scope;
 }
        /// <exclude />
        public IData GetParent(IData data)
        {
            if (data == null) throw new ArgumentNullException("data");

            Entry entry = GetEntry(data.GetType());
            object propertyValue = entry.PropertyValueMethodInfo.Invoke(data, null);

            if (entry.PropertyValueMethodInfo.ReturnType == typeof(Guid))
            {
                if (Equals(propertyValue, Guid.Empty)) return null;
            }
            else
            {
                if (Equals(propertyValue, entry.NullValue)) return null;
            }

            using (DataScope dataScope = new DataScope(data.DataSourceId.DataScopeIdentifier))
            {
                List<object> queryResult = GetQueryResult(entry.ParentDataType, entry.ParentIdPropertyName, propertyValue);

                if (queryResult.Count == 0) throw new InvalidOperationException(string.Format("The parent of the type {0} with the id ({1}) value of {2} was not found", entry.ParentDataType, entry.ParentIdPropertyName, propertyValue));
                if (queryResult.Count > 1) throw new InvalidOperationException(string.Format("More than one parent of the type {0} with the id ({1}) value of {2} was found", entry.ParentDataType, entry.ParentIdPropertyName, propertyValue));

                return (IData)queryResult[0];
            }
        }
        // GetDownloadRequestId helper method calls the DownloadCampaignsByAccountIds service operation 
        // to request the download identifier.
        private async Task<string> GetDownloadRequestId(long accountId, DataScope dataScope, BulkDownloadEntity entities,
            string formatVersion, DateTime? lastSyncTime, PerformanceStatsDateRange dateRange)
        {
            var request = new DownloadCampaignsByAccountIdsRequest
            {
                AccountIds = new List<long> { accountId },
                DataScope = dataScope,
                DownloadFileType = FileFormat,
                Entities = entities,
                FormatVersion = formatVersion,
                LastSyncTimeInUTC = lastSyncTime,
                PerformanceStatsDateRange = dateRange
            };

            return (await Service.CallAsync(
                (s, r) => s.DownloadCampaignsByAccountIdsAsync(r), request)).DownloadRequestId;
        }
 public GetDateGenerator(DataScope scope) { this._scope = scope; }
 public NewGuidGenerator(DataScope scope) { this._scope = scope; }
Exemple #38
0
        private static bool ExistsInOtherLocale(IPage page)
        {
            foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures.Except(new CultureInfo[] { page.DataSourceId.LocaleScope }))
            {
                using (DataScope dataScope = new DataScope(cultureInfo))
                {
                    bool exists = DataFacade.GetData<IPage>(f => f.Id == page.Id).Any();
                    if (exists)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
Exemple #39
0
        /// <exclude />
        public static IPage GetPageFromLocalOrder(Guid parentId, int localOrder)
        {
            Guid pageId;
            using (DataScope dataScope = new DataScope(DataScopeIdentifier.Administrated))
            {
// FirstOrDefault used here because local ordering could be "corrupt"
                IPageStructure pageStructure =
                    (from ps in DataFacade.GetData<IPageStructure>()
                     where ps.ParentId == parentId &&
                           ps.LocalOrdering == localOrder
                     select ps).FirstOrDefault();

                if (pageStructure == null) return null;
                
                pageId = pageStructure.Id;
            }

            return DataFacade.GetData<IPage>(f => f.Id == pageId).FirstOrDefault();
        }
        /// <summary>
        /// Gets the data value for a specific scope.
        /// </summary>
        /// <param name="entity">The entity to read from.</param>
        /// <param name="scope">The scope of the read.</param>
        /// <returns>The original or generated value.</returns>
        /// <remarks>The original class is updated if a value is generated.</remarks>
        public object GetValue(object entity, DataScope scope)
        {
            object value = base.GetValue(entity);

            if (_Generator != null && (_Generator.GeneratorScope == scope || scope == DataScope.Save))
            {
                if (ValidationHelper.IsNullOrEmpty(value))
                {
                    value = _Generator.Generate();
                    SetValue(entity, value);
                }
                return value;
            }
            else
            {
                return _Nullable && ValidationHelper.IsNullOrEmpty(value) ? null : value;
            }


        }