示例#1
0
        public virtual void Hydrate(string hydrateFrom)
        {
            EventStore copy = SerializationUtil.DeserializeFromFile <EventStore>(hydrateFrom);

            DefaultConfiguration.CopyProperties(copy, this);
            //this.FromXml<EventStore>(hydrateFrom);
        }
示例#2
0
        /// <summary>
        /// Creates an in memory dynamic type representing
        /// the specified DaoObject's DaoColumns only.
        /// </summary>
        /// <param name="daoObject"></param>
        /// <returns></returns>
        public static object ToJsonSafe(this DaoObject daoObject)
        {
            Type            jsonSafeType     = CreateDynamicType <DaoColumn>(daoObject, false);
            ConstructorInfo ctor             = jsonSafeType.GetConstructor(new Type[] { });
            object          jsonSafeInstance = ctor.Invoke(null);//Activator.CreateInstance(jsonSafeType);

            DefaultConfiguration.CopyProperties(daoObject, jsonSafeInstance);
            return(jsonSafeInstance);
        }
示例#3
0
 /// <summary>
 /// Get a BamConf instance which represents the current
 /// state of the BamServer
 /// </summary>
 /// <returns></returns>
 internal protected BamConf GetCurrentConf(bool reload = true)
 {
     lock (_confLock)
     {
         if (reload || _conf == null)
         {
             BamConf conf = new BamConf();
             DefaultConfiguration.CopyProperties(this, conf);
             conf.Server = this;
             _conf       = conf;
         }
     }
     return(_conf);
 }
示例#4
0
        public void SetConf(BamConf conf)
        {
            OnSettingConf(conf);

            this.MainLogger = Log.Default = conf.GetMainLogger(out Type loggerType);
            this.MainLogger.RestartLoggingThread();
            if (!loggerType.Name.Equals(conf.MainLoggerName))
            {
                MainLogger.AddEntry("Configured MainLogger was ({0}) but the Logger found was ({1})", LogEventType.Warning, conf.MainLoggerName, loggerType.Name);
            }
            this.TryAddAdditionalLoggers(conf);
            conf.Server = this;

            DefaultConfiguration.CopyProperties(conf, this);
            SetWorkspace();

            OnSettedConf(conf);
        }
示例#5
0
        public static MailMessage Merge(this MailMessage messageOne, MailMessage message, bool mergeBody, string bodySeparator, bool mergeSubject, string subjectSeparator)
        {
            MailMessage mergedMessage = new MailMessage();

            DefaultConfiguration.CopyProperties(messageOne, mergedMessage);

            foreach (MailAddress address in messageOne.To)
            {
                mergedMessage.To.Add(address);
            }

            foreach (MailAddress address in message.To)
            {
                mergedMessage.To.Add(address);
            }

            foreach (MailAddress address in message.CC)
            {
                mergedMessage.CC.Add(address);
            }

            foreach (MailAddress address in message.Bcc)
            {
                mergedMessage.Bcc.Add(address);
            }

            if (mergeBody)
            {
                StringBuilder newBody = new StringBuilder(mergedMessage.Body);
                newBody.AppendFormat("{0}{1}", bodySeparator, message.Body);
                mergedMessage.Body = newBody.ToString();
            }

            if (mergeSubject)
            {
                StringBuilder newSubject = new StringBuilder(mergedMessage.Subject);
                newSubject.AppendFormat("{0}{1}", subjectSeparator, message.Subject);
                mergedMessage.Subject = newSubject.ToString();
            }

            return(mergedMessage);
        }
示例#6
0
 internal RequestWrapper(object requestToBeWrapped)
 {
     DefaultConfiguration.CopyProperties(requestToBeWrapped, this);
     this.Wrapped = requestToBeWrapped;
 }
示例#7
0
 public RequestWrapper(HttpRequestBase request)
 {
     DefaultConfiguration.CopyProperties(request, this);
     this.Wrapped = request;
 }
示例#8
0
 public ResponseWrapper(HttpResponseBase response)
 {
     DefaultConfiguration.CopyProperties(response, this);
     this.Wrapped = response;
 }