Exemplo n.º 1
0
        /// <summary>
        ///   Triggers the LoggedIn event.
        /// </summary>
        protected virtual void OnLoggedIn()
        {
            DebugFns.WriteLine(string.Format(StringResources.SuccessfullyLoggedIn, ConnectionOptions.Name,
                                             ConnectionOptions.IsFake));

            NotifyPropertyChanged("IsLoggedIn");
            LoggedIn(this, EventArgs.Empty);
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Resets the fake backing store to its initial state.
        /// </summary>
        /// <returns> Returns true if the EntityManagerProvider supports the fake backing store. </returns>
        public static bool ResetFakeBackingStore <T>(this IEntityManagerProvider <T> @this) where T : EntityManager
        {
            if ([email protected] || !(@this is EntityManagerProvider <T>))
            {
                DebugFns.WriteLine(StringResources.NonSuitableEmpForFakeStoreOperation);
                return(false);
            }

            ((EntityManagerProvider <T>)@this).ResetFakeBackingStore();
            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        ///   Creates a new EntityManager instance.
        /// </summary>
        protected virtual T CreateEntityManager()
        {
            try
            {
                var connectionOptions = ConnectionOptions;
                var manager           = (T)Activator.CreateInstance(typeof(T), connectionOptions.ToEntityManagerContext());

                DebugFns.WriteLine(string.Format(StringResources.SuccessfullyCreatedEntityManager,
                                                 manager.GetType().FullName, connectionOptions.Name,
                                                 connectionOptions.IsFake));
                return(manager);
            }
            catch (MissingMemberException inner)
            {
                throw new InvalidOperationException(string.Format(StringResources.MissingEntityManagerConstructor,
                                                                  typeof(T).Name), inner);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///   Initializes the fake backing store.
        /// </summary>
        /// <returns> Returns true if the EntityManagerProvider supports the fake backing store. </returns>
        public static bool InitializeFakeBackingStore <T>(this IEntityManagerProvider <T> @this) where T : EntityManager
        {
            if ([email protected])
            {
                DebugFns.WriteLine(StringResources.NonSuitableEmpForFakeStoreOperation);
                return(false);
            }

            // Return if already initialized
            if (FakeBackingStore.Exists(@this.Manager.CompositionContext.Name))
            {
                return(true);
            }

            FakeBackingStore.Create(@this.Manager.CompositionContext.Name);

            ResetFakeBackingStore(@this);
            return(true);
        }
Exemplo n.º 5
0
 public static void DebugWriteLineIf(bool condition, object aObject)
 {
     DebugFns.WriteLineIf(condition, FormatLogMessage(aObject));
 }
Exemplo n.º 6
0
 public static void DebugWriteLine(object aObject)
 {
     DebugFns.WriteLine(FormatLogMessage(aObject));
 }
Exemplo n.º 7
0
 /// <summary>Writes log messages to <see cref="System.Diagnostics.Debug"/>.</summary>
 private static void LogWriter(string message)
 {
     DebugFns.WriteLine(message);
 }