EverestDataContextWrapper.cs :  » Content-Management-Systems-CMS » Kooboo » Everest » CmsServices » Models » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Content Management Systems CMS » Kooboo 
Kooboo » Everest » CmsServices » Models » EverestDataContextWrapper.cs
/*
Kooboo is a content management system based on ASP.NET MVC framework. Copyright 2009 Yardi Technology Limited.

This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.kooboo.com/gpl3/.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Objects;
using System.Data.EntityClient;

using Everest.Library.Data;
using Everest.Library.Data.Rule;
using Everest.Library.Data.Entity;
using Everest.Library.ExtensionMethod;
using Everest.Library.Providers.Caching;
using Microsoft.Data.Extensions;
using System.Data.Common;
using EFTracingProvider;
using EFCachingProvider.Caching;

namespace Everest.CmsServices.Models{
    /// <summary>
    /// 
    /// </summary>
    public class EverestDataContextWrapper : IEverestCmsDataContext
    {
        static ICache cache = new InMemoryCache();
        EverestCmsEntities dataContext;
        /// <summary>
        /// Initializes a new instance of the <see cref="EverestDataContextWrapper"/> class.
        /// </summary>
        /// <param name="dataContext">The data context.</param>
        public EverestDataContextWrapper(ExtendedEverestCmsEntities dataContext)
        {
            dataContext.Cache = cache;
            this.dataContext = dataContext;
        }

        #region IEverestCmsDataContext Members

        #region Query
        public System.Data.Objects.ObjectQuery<aspnet_Applications> aspnet_Applications
        {
            get { return this.dataContext.aspnet_Applications; }
        }

        public System.Data.Objects.ObjectQuery<aspnet_Membership> aspnet_Membership
        {
            get { return this.dataContext.aspnet_Membership; }
        }

        public System.Data.Objects.ObjectQuery<aspnet_Paths> aspnet_Paths
        {
            get { return this.dataContext.aspnet_Paths; }
        }

        public System.Data.Objects.ObjectQuery<aspnet_PersonalizationAllUsers> aspnet_PersonalizationAllUsers
        {
            get { return this.dataContext.aspnet_PersonalizationAllUsers; }
        }

        public System.Data.Objects.ObjectQuery<aspnet_PersonalizationPerUser> aspnet_PersonalizationPerUser
        {
            get { return this.dataContext.aspnet_PersonalizationPerUser; }
        }

        public System.Data.Objects.ObjectQuery<aspnet_Profile> aspnet_Profile
        {
            get { return this.dataContext.aspnet_Profile; }
        }

        public System.Data.Objects.ObjectQuery<aspnet_Roles> aspnet_Roles
        {
            get { return this.dataContext.aspnet_Roles; }
        }

        public System.Data.Objects.ObjectQuery<aspnet_SchemaVersions> aspnet_SchemaVersions
        {
            get { return this.dataContext.aspnet_SchemaVersions; }
        }

        public System.Data.Objects.ObjectQuery<aspnet_Users> aspnet_Users
        {
            get { return this.dataContext.aspnet_Users; }
        }

        public System.Data.Objects.ObjectQuery<aspnet_WebEvent_Events> aspnet_WebEvent_Events
        {
            get { return this.dataContext.aspnet_WebEvent_Events; }
        }

        public System.Data.Objects.ObjectQuery<Cms_BinaryContent> Cms_BinaryContent
        {
            get { return this.dataContext.Cms_BinaryContent; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Column> Cms_Column
        {
            get { return this.dataContext.Cms_Column; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Content> Cms_Content
        {
            get { return this.dataContext.Cms_Content; }
        }

        public System.Data.Objects.ObjectQuery<Cms_ContentFile> Cms_ContentFile
        {
            get { return this.dataContext.Cms_ContentFile; }
        }

        public System.Data.Objects.ObjectQuery<Cms_ContentTemplate> Cms_ContentTemplate
        {
            get { return this.dataContext.Cms_ContentTemplate; }
        }

        public System.Data.Objects.ObjectQuery<Cms_ContentTemplateInPageHolder> Cms_ContentTemplateInPageHolder
        {
            get { return this.dataContext.Cms_ContentTemplateInPageHolder; }
        }

        public System.Data.Objects.ObjectQuery<Cms_ContentTemplateParameters> Cms_ContentTemplateParameters
        {
            get { return this.dataContext.Cms_ContentTemplateParameters; }
        }

        public System.Data.Objects.ObjectQuery<Cms_DataRule> Cms_DataRule
        {
            get { return this.dataContext.Cms_DataRule; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Folder> Cms_Folder
        {
            get { return this.dataContext.Cms_Folder; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Page> Cms_Page
        {
            get { return this.dataContext.Cms_Page; }
        }

        public System.Data.Objects.ObjectQuery<Cms_PageTemplateHolders> Cms_PageTemplateHolders
        {
            get { return this.dataContext.Cms_PageTemplateHolders; }
        }

        public System.Data.Objects.ObjectQuery<Cms_PageTemplate> Cms_PageTemplate
        {
            get { return this.dataContext.Cms_PageTemplate; }
        }

        public System.Data.Objects.ObjectQuery<Cms_ParameterValues> Cms_ParameterValues
        {
            get { return this.dataContext.Cms_ParameterValues; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Permission> Cms_Permission
        {
            get { return this.dataContext.Cms_Permission; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Plugin> Cms_Plugin
        {
            get { return this.dataContext.Cms_Plugin; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Properties> Cms_Properties
        {
            get { return this.dataContext.Cms_Properties; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Schedule> Cms_Schedule
        {
            get { return this.dataContext.Cms_Schedule; }
        }

        public System.Data.Objects.ObjectQuery<Cms_ScheduleParameter> Cms_ScheduleParameter
        {
            get { return this.dataContext.Cms_ScheduleParameter; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Schema> Cms_Schema
        {
            get { return this.dataContext.Cms_Schema; }
        }

        public System.Data.Objects.ObjectQuery<Cms_Validator> Cms_Validator
        {
            get { return this.dataContext.Cms_Validator; }
        }

        public System.Data.Objects.ObjectQuery<Cms_ValidatorGroup> Cms_ValidatorGroup
        {
            get { return this.dataContext.Cms_ValidatorGroup; }
        }

        public System.Data.Objects.ObjectQuery<Cms_TextResource> Cms_TextResource
        {
            get { return this.dataContext.Cms_TextResource; }
        }
        public global::System.Data.Objects.ObjectQuery<Cms_SchemaFunction> Cms_SchemaFunction
        {
            get { return this.dataContext.Cms_SchemaFunction; }
        }
        public global::System.Data.Objects.ObjectQuery<Cms_SearchSetting> Cms_SearchSetting
        {
            get { return this.dataContext.Cms_SearchSetting; }
        }
        public ObjectQuery<Cms_ModuleApplication> Cms_ModuleApplication
        {
            get { return dataContext.Cms_ModuleApplication; }
        }


        #endregion

        #region Add
        /// <summary>
        /// Adds the object.
        /// </summary>
        /// <param name="entitySetName">Name of the entity set.</param>
        /// <param name="entity">The entity.</param>
        public void AddObject(string entitySetName, object entity)
        {
            this.dataContext.AddObject(entitySetName, entity);
        }
        /// <summary>
        /// There are no comments for aspnet_Applications in the schema.
        /// </summary>
        public void AddToaspnet_Applications(aspnet_Applications aspnet_Applications)
        {
            this.AddObject("aspnet_Applications", aspnet_Applications);
        }
        /// <summary>
        /// There are no comments for aspnet_Membership in the schema.
        /// </summary>
        public void AddToaspnet_Membership(aspnet_Membership aspnet_Membership)
        {
            this.AddObject("aspnet_Membership", aspnet_Membership);
        }
        /// <summary>
        /// There are no comments for aspnet_Paths in the schema.
        /// </summary>
        public void AddToaspnet_Paths(aspnet_Paths aspnet_Paths)
        {
            this.AddObject("aspnet_Paths", aspnet_Paths);
        }
        /// <summary>
        /// There are no comments for aspnet_PersonalizationAllUsers in the schema.
        /// </summary>
        public void AddToaspnet_PersonalizationAllUsers(aspnet_PersonalizationAllUsers aspnet_PersonalizationAllUsers)
        {
            this.AddObject("aspnet_PersonalizationAllUsers", aspnet_PersonalizationAllUsers);
        }
        /// <summary>
        /// There are no comments for aspnet_PersonalizationPerUser in the schema.
        /// </summary>
        public void AddToaspnet_PersonalizationPerUser(aspnet_PersonalizationPerUser aspnet_PersonalizationPerUser)
        {
            this.AddObject("aspnet_PersonalizationPerUser", aspnet_PersonalizationPerUser);
        }
        /// <summary>
        /// There are no comments for aspnet_Profile in the schema.
        /// </summary>
        public void AddToaspnet_Profile(aspnet_Profile aspnet_Profile)
        {
            this.AddObject("aspnet_Profile", aspnet_Profile);
        }
        /// <summary>
        /// There are no comments for aspnet_Roles in the schema.
        /// </summary>
        public void AddToaspnet_Roles(aspnet_Roles aspnet_Roles)
        {
            this.AddObject("aspnet_Roles", aspnet_Roles);
        }
        /// <summary>
        /// There are no comments for aspnet_SchemaVersions in the schema.
        /// </summary>
        public void AddToaspnet_SchemaVersions(aspnet_SchemaVersions aspnet_SchemaVersions)
        {
            this.AddObject("aspnet_SchemaVersions", aspnet_SchemaVersions);
        }
        /// <summary>
        /// There are no comments for aspnet_Users in the schema.
        /// </summary>
        public void AddToaspnet_Users(aspnet_Users aspnet_Users)
        {
            this.AddObject("aspnet_Users", aspnet_Users);
        }
        /// <summary>
        /// There are no comments for aspnet_WebEvent_Events in the schema.
        /// </summary>
        public void AddToaspnet_WebEvent_Events(aspnet_WebEvent_Events aspnet_WebEvent_Events)
        {
            this.AddObject("aspnet_WebEvent_Events", aspnet_WebEvent_Events);
        }
        /// <summary>
        /// There are no comments for Cms_BinaryContent in the schema.
        /// </summary>
        public void AddToCms_BinaryContent(Cms_BinaryContent cms_BinaryContent)
        {
            this.AddObject("Cms_BinaryContent", cms_BinaryContent);
        }
        /// <summary>
        /// There are no comments for Cms_Column in the schema.
        /// </summary>
        public void AddToCms_Column(Cms_Column cms_Column)
        {
            this.AddObject("Cms_Column", cms_Column);
        }
        /// <summary>
        /// There are no comments for Cms_Content in the schema.
        /// </summary>
        public void AddToCms_Content(Cms_Content cms_Content)
        {
            this.AddObject("Cms_Content", cms_Content);
        }
        /// <summary>
        /// There are no comments for Cms_ContentFile in the schema.
        /// </summary>
        public void AddToCms_ContentFile(Cms_ContentFile cms_ContentFile)
        {
            this.AddObject("Cms_ContentFile", cms_ContentFile);
        }
        /// <summary>
        /// There are no comments for Cms_ContentTemplate in the schema.
        /// </summary>
        public void AddToCms_ContentTemplate(Cms_ContentTemplate cms_ContentTemplate)
        {
            this.AddObject("Cms_ContentTemplate", cms_ContentTemplate);
        }
        /// <summary>
        /// There are no comments for Cms_ContentTemplateInPageHolder in the schema.
        /// </summary>
        public void AddToCms_ContentTemplateInPageHolder(Cms_ContentTemplateInPageHolder cms_ContentTemplateInPageHolder)
        {
            this.AddObject("Cms_ContentTemplateInPageHolder", cms_ContentTemplateInPageHolder);
        }
        /// <summary>
        /// There are no comments for Cms_ContentTemplateParameters in the schema.
        /// </summary>
        public void AddToCms_ContentTemplateParameters(Cms_ContentTemplateParameters cms_ContentTemplateParameters)
        {
            this.AddObject("Cms_ContentTemplateParameters", cms_ContentTemplateParameters);
        }
        /// <summary>
        /// There are no comments for Cms_DataRule in the schema.
        /// </summary>
        public void AddToCms_DataRule(Cms_DataRule cms_DataRule)
        {
            this.AddObject("Cms_DataRule", cms_DataRule);
        }
        /// <summary>
        /// There are no comments for Cms_Folder in the schema.
        /// </summary>
        public void AddToCms_Folder(Cms_Folder cms_Folder)
        {
            this.AddObject("Cms_Folder", cms_Folder);
        }

        /// <summary>
        /// There are no comments for Cms_Page in the schema.
        /// </summary>
        public void AddToCms_Page(Cms_Page cms_Page)
        {
            this.AddObject("Cms_Page", cms_Page);
        }
        /// <summary>
        /// There are no comments for Cms_PageHolder in the schema.
        /// </summary>
        public void AddToCms_PageHolder(Cms_PageTemplateHolders cms_PageHolder)
        {
            this.AddObject("Cms_PageHolder", cms_PageHolder);
        }
        /// <summary>
        /// There are no comments for Cms_PageTemplate in the schema.
        /// </summary>
        public void AddToCms_PageTemplate(Cms_PageTemplate cms_PageTemplate)
        {
            this.AddObject("Cms_PageTemplate", cms_PageTemplate);
        }
        /// <summary>
        /// There are no comments for Cms_ParameterValues in the schema.
        /// </summary>
        public void AddToCms_ParameterValues(Cms_ParameterValues cms_ParameterValues)
        {
            this.AddObject("Cms_ParameterValues", cms_ParameterValues);
        }
        /// <summary>
        /// There are no comments for Cms_Permission in the schema.
        /// </summary>
        public void AddToCms_Permission(Cms_Permission cms_Permission)
        {
            this.AddObject("Cms_Permission", cms_Permission);
        }
        /// <summary>
        /// There are no comments for Cms_Plugin in the schema.
        /// </summary>
        public void AddToCms_Plugin(Cms_Plugin cms_Plugin)
        {
            this.AddObject("Cms_Plugin", cms_Plugin);
        }
        /// <summary>
        /// There are no comments for Cms_Properties in the schema.
        /// </summary>
        public void AddToCms_Properties(Cms_Properties cms_Properties)
        {
            this.AddObject("Cms_Properties", cms_Properties);
        }
        /// <summary>
        /// There are no comments for Cms_Schedule in the schema.
        /// </summary>
        public void AddToCms_Schedule(Cms_Schedule cms_Schedule)
        {
            this.AddObject("Cms_Schedule", cms_Schedule);
        }
        /// <summary>
        /// There are no comments for Cms_ScheduleParameter in the schema.
        /// </summary>
        public void AddToCms_ScheduleParameter(Cms_ScheduleParameter cms_ScheduleParameter)
        {
            this.AddObject("Cms_ScheduleParameter", cms_ScheduleParameter);
        }
        /// <summary>
        /// There are no comments for Cms_Schema in the schema.
        /// </summary>
        public void AddToCms_Schema(Cms_Schema cms_Schema)
        {
            this.AddObject("Cms_Schema", cms_Schema);
        }
        /// <summary>
        /// There are no comments for Cms_Validator in the schema.
        /// </summary>
        public void AddToCms_Validator(Cms_Validator cms_Validator)
        {
            this.AddObject("Cms_Validator", cms_Validator);
        }
        /// <summary>
        /// There are no comments for Cms_ValidatorGroup in the schema.
        /// </summary>
        public void AddToCms_ValidatorGroup(Cms_ValidatorGroup cms_ValidatorGroup)
        {
            this.AddObject("Cms_ValidatorGroup", cms_ValidatorGroup);
        }
        /// <summary>
        /// There are no comments for Cms_TextResource in the schema.
        /// </summary>
        public void AddToCms_TextResource(Cms_TextResource cms_TextResource)
        {
            this.AddObject("Cms_TextResource", cms_TextResource);
        }
        public void AddToCms_SchemaFunction(Cms_SchemaFunction cms_SchemaFunction)
        {
            this.AddObject("Cms_SchemaFunction", cms_SchemaFunction);
        }
        public void AddToCms_SearchSetting(Cms_SearchSetting cms_SearchSetting)
        {
            this.AddObject("Cms_SearchSetting", cms_SearchSetting);
        }
        public void AddToCms_ModuleApplication(Cms_ModuleApplication cms_ModuleApplication)
        {
            dataContext.AddToCms_ModuleApplication(cms_ModuleApplication);
        }
        #endregion



        public void DeleteObject(object entity)
        {
            this.dataContext.DeleteObject(entity);
        }

        public int SaveChanges()
        {
            var entities = this.dataContext.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Added | System.Data.EntityState.Modified | System.Data.EntityState.Deleted);

            List<string> cacheGroups = new List<string>();

            foreach (var entity in entities)
            {
                if (entity.Entity is IRuleEntity && entity.State != System.Data.EntityState.Deleted)
                {
                    Validate((IRuleEntity)entity.Entity);
                }
                if (entity.Entity != null)
                {
                    IEnumerable<string> groups = CachedData.GetCacheGroupNames(entity.Entity.GetType());
                    if (groups != null)
                    {
                        cacheGroups.AddRange(groups);
                    }
                }

            }
            CacheManager.RemoveCacheGroups(cacheGroups);
            try
            {
                return this.dataContext.SaveChanges();
            }
            catch
            {
                Rollback();
                throw;
            }

        }

        #endregion

        #region IEverestCmsDataContext Members

        public ObjectContext ObjectContext
        {
            get { return this.dataContext; }
        }

        public ObjectQuery<Cms_Workflow> Cms_Workflow
        {
            get { return dataContext.Cms_Workflow; }
        }

        public ObjectQuery<Cms_WorkflowSequence> Cms_WorkflowSequence
        {
            get { return dataContext.Cms_WorkflowSequence; }
        }
        public System.Data.Objects.ObjectQuery<Cms_WorkflowHistory> Cms_WorkflowHistory
        {
            get
            {
                return dataContext.Cms_WorkflowHistory;
            }
        }
        public void AddToCms_Workflow(Cms_Workflow cms_Workflow)
        {
            dataContext.AddToCms_Workflow(cms_Workflow);
        }

        public void AddToCms_WorkflowSequence(Cms_WorkflowSequence cms_WorkflowSequence)
        {
            dataContext.AddToCms_WorkflowSequence(cms_WorkflowSequence);
        }
        public void AddToCms_WorkflowHistory(Cms_WorkflowHistory cms_WorkflowHistory)
        {
            dataContext.AddToCms_WorkflowHistory(cms_WorkflowHistory);
        }


        public ObjectQuery<Cms_CustomerForm> Cms_CustomerForm
        {
            get { return dataContext.Cms_CustomerForm; }
        }

        public ObjectQuery<Cms_CustomerFormValues> Cms_CustomerFormValues
        {
            get { return dataContext.Cms_CustomerFormValues; }
        }

        public void AddToCms_CustomerForm(Cms_CustomerForm Cms_CustomerForm)
        {
            dataContext.AddToCms_CustomerForm(Cms_CustomerForm);
        }

        public void AddToCms_CustomerFormValues(Cms_CustomerFormValues cms_CustomerFormValues)
        {
            dataContext.AddToCms_CustomerFormValues(cms_CustomerFormValues);
        }


        public ObjectQuery<Cms_ContentInFolder> Cms_ContentInFolder
        {
            get { return this.dataContext.Cms_ContentInFolder; }
        }

        public void AddToCms_ContentInFolder(Cms_ContentInFolder cms_ContentInFolder)
        {
            this.dataContext.AddToCms_ContentInFolder(cms_ContentInFolder);
        }



        public ObjectQuery<Cms_ModulePermission> Cms_ModulePermission
        {
            get { return this.dataContext.Cms_ModulePermission; }
        }

        public void AddToCms_ModulePermission(Cms_ModulePermission cms_ModulePermission)
        {
            this.dataContext.AddToCms_ModulePermission(cms_ModulePermission);
        }

        public ObjectQuery<Cms_ModuleSetting> Cms_ModuleSetting
        {
            get { return this.dataContext.Cms_ModuleSetting; }
        }

        public void AddToCms_ModuleSetting(Cms_ModuleSetting cms_ModuleSetting)
        {
            this.dataContext.AddToCms_ModuleSetting(cms_ModuleSetting);
        }



        public ObjectQuery<Cms_CustomError> Cms_CustomError
        {
            get { return dataContext.Cms_CustomError; }
        }

        public ObjectQuery<Cms_IndexTrigger> Cms_IndexTrigger
        {
            get { return dataContext.Cms_IndexTrigger; }
        }

        public void AddToCms_IndexTrigger(Cms_IndexTrigger cms_IndexTrigger)
        {
            dataContext.AddToCms_IndexTrigger(cms_IndexTrigger);
        }

        #endregion

        #region Validation
        private void Validate(IRuleEntity entity)
        {
            violations = entity.GetRuleViolations();
            if (violations.Count() > 0)
            {
                throw new RuleViolationException(violations);
            }
        }

        IEnumerable<RuleViolation> violations;
        #region IEverestCmsDataContext Members

        public IEnumerable<RuleViolation> GetViolations()
        {
            return violations;
        }

        #endregion
        #endregion

        #region IDisposable Members

        public void Dispose()
        {
            if (dbTrans != null)
            {
                dbTrans.Rollback();
                dbTrans.Dispose();
            }
            if (this.dataContext != null)
            {
                this.dataContext.Dispose();
                this.dataContext = null;
            }
        }

        #endregion


        #region IEverestCmsDataContext Members

        private DbTransaction dbTrans = null;
        /// <summary>
        /// Begins the transaction.
        /// </summary>
        /// <returns></returns>
        public DbTransaction BeginTransaction()
        {
            if (dataContext.Connection.State == ConnectionState.Closed)
                dataContext.Connection.Open();
            dbTrans = dataContext.Connection.BeginTransaction();
            return dbTrans;
        }
        /// <summary>
        /// Commits this instance.
        /// </summary>
        public void Commit()
        {
            if (dbTrans != null)
            {
                dbTrans.Commit();
                dbTrans.Dispose();
                dbTrans = null;
                if (dataContext.Connection.State == ConnectionState.Open)
                    dataContext.Connection.Close();
            }
        }

        public void Rollback()
        {
            if (dbTrans != null)
            {
                dbTrans.Rollback();
                dbTrans.Dispose();
                dbTrans = null;
                if (dataContext.Connection.State == ConnectionState.Open)
                    dataContext.Connection.Close();
            }
        }
        #endregion

        #region Caching & Tracing


        public bool LogToConsole
        {
            get
            {
                return EFTracingProviderConfiguration.LogToConsole;
            }
            set
            {
                EFTracingProviderConfiguration.LogToConsole = value;
            }
        }

        public string LogToFile
        {
            get
            {
                return EFTracingProviderConfiguration.LogToFile;
            }
            set
            {
                EFTracingProviderConfiguration.LogToFile = value;
            }
        }

        public System.IO.TextWriter LogOutput
        {
            get
            {
                return ((ExtendedEverestCmsEntities)this.ObjectContext).Log;
            }
            set
            {
                ((ExtendedEverestCmsEntities)this.ObjectContext).Log = value;
            }
        }

        bool enableCaching = false;
        public bool EnableCaching
        {
            get
            {
                return enableCaching;
            }
            set
            {
                enableCaching = value;
                if (value == true)
                {
                    var context = ((ExtendedEverestCmsEntities)this.ObjectContext);
                    context.CachingPolicy = CachingPolicy.CacheAll;
                }
                else
                {
                    var context = ((ExtendedEverestCmsEntities)this.ObjectContext);
                    context.CachingPolicy = CachingPolicy.NoCaching;
                }
            }
        }

        #endregion


        #region IEverestCmsDataContext Members


        public ObjectQuery<Cms_RssChannel> Cms_RssChannel
        {
            get { return dataContext.Cms_RssChannel; }
        }

        public void AddToCms_RssChannel(Cms_RssChannel cms_RssChannel)
        {
            dataContext.AddToCms_RssChannel(cms_RssChannel);
        }

        #endregion

        #region IEverestCmsDataContext Members


        public ObjectQuery<Cms_ContentReferencing> Cms_ContentReferencing
        {
            get { return this.dataContext.Cms_ContentReferencing; }
        }

        public void AddToCms_ContentReferencing(Cms_ContentReferencing cms_ContentReferencing)
        {
            this.dataContext.AddToCms_ContentReferencing(cms_ContentReferencing);
        }

        #endregion
    }
}

www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.