protected override XElement Validate(XElement item)
        {
            // Validate with XSD
            XElement xsdErrors = this.ValidateXSD(item, HttpContext.Current.Server.MapPath(@"~\Xslt\Senior\Senior.xsd"));
            if (xsdErrors != null && xsdErrors.Elements("Error").Count() > 0)
            {
                return xsdErrors;
            }

            // Validate with Stored Proc
            string result = string.Empty;
            using (Persistence oDB = new Persistence())
            {
                Persistence.ParameterCollection parameters = new Persistence.ParameterCollection();
                parameters.Add("InputXml");
                parameters[0].Value = item.ToString();
                oDB.Execute("Masters_ConnectionString", "ValidateSeniorData", parameters, out result);
            }

            if (!string.IsNullOrEmpty(result))
            {
                XElement spErrors = XElement.Parse(result);
                spErrors.Elements("Error").Where(e => string.IsNullOrEmpty(e.Value)).Remove();

                if (spErrors.Elements("Error").Count() > 0)
                {
                    return spErrors;
                }
            }

            // SUCCESS!
            return null;

        }
Exemple #2
0
        public void Import(Persistence.Lookup settings)
        {
            MasterController.Settings.SkillStamps.Clear();
            MasterController.Settings.SkillStamps.AddRange(settings.GetList<SkillStamp>(""));

            MasterController.Settings.UpdateStamp();
        }
Exemple #3
0
 public Tracker(Persistence.IPersister persister, Persistence.Finder.IItemFinder find, N2.Web.IUrlParser urlParser, N2.Web.IErrorHandler errorHandler)
 {
     this.persister = persister;
     this.find = find;
     this.urlParser = urlParser;
     this.errorHandler = errorHandler;
 }
Exemple #4
0
        public static Dto.Store ToDto(Pst.Store domain)
        {
            if (domain == null)
            {
                return null;
            }

            return new Dto.Store()
            {
                About = domain.About,
                City = domain.City,
                Contact = domain.Contact,
                Directions = domain.Directions,
                Email = domain.Email,
                FacebookUrl = domain.FacebookUrl,
                GooglePlusUrl = domain.GooglePlusUrl,
                Home = domain.Home,
                Hours = BitArrayConverter.ToBits(domain.Hours),
                InstagramUrl = domain.InstagramUrl,
                PhoneNumber = domain.PhoneNumber,
                PinterestUrl = domain.PinterestUrl,
                State = domain.State,
                StreetAddress = domain.StreetAddress,
                TwitterUrl = domain.TwitterUrl,
                YoutubeUrl = domain.YoutubeUrl,
                Zip = domain.Zip
            };
        }
Exemple #5
0
 public void Export(Persistence.Lookup settings)
 {
     settings.Add("AgeSpecies", mKey.mAgeSpecies.ToString());
     settings.Add("Occult", mKey.mOccult.ToString());
     settings.Add("Commodity", mKey.mKind.ToString());
     settings.Add("Value", mValue);
 }
Exemple #6
0
 internal static Db.Photo ConvertToDatabase(Photo dmn, Db.Photo db)
 {
     CvrtPhoto domain = new CvrtPhoto(dmn);
     db.Url = domain.Url;
     db.Description = domain.Description;
     return db;
 }
        public void Clear_ShouldClearAllAndLog(
            [Frozen]Mock<ILogger> logger,
            [Frozen]Mock<IEntityFrameworkContext> efContext,
            [Frozen]Mock<IAzureQueueContext> aqContext,
            [Frozen]Mock<IAzureTableContext> atContext,
            [Frozen]Mock<IAzureBlobContext> abContext,
            [Frozen]Mock<IEntityFrameworkChangeTracker> changeTracker,
            Persistence.UnitOfWork uow)
        {
            EntityFrameworkContextExtensions.Factory = efc => changeTracker.Object;

            // Act

            uow.Clear();

            // Assert

            changeTracker.Verify(t => t.Clear(), Times.Once);
            aqContext.Verify(c => c.Clear(), Times.Once);
            atContext.Verify(c => c.Clear(), Times.Once);
            abContext.Verify(c => c.Clear(), Times.Once);

            logger.Verify(l => l.Log("Clearing Entity Framework context..."), Times.Once);
            logger.Verify(l => l.Log("Clearing Azure Queue context..."), Times.Once);
            logger.Verify(l => l.Log("Clearing Azure Table context..."), Times.Once);
            logger.Verify(l => l.Log("Clearing Azure Blob context..."), Times.Once);
        }
Exemple #8
0
        private static void ConvertLayoutTypes(TypeVisualiserLayoutFile oldDiagram, Persistence.CanvasLayoutData canvasLayoutv105)
        {
            foreach (TypeLayoutData oldType in oldDiagram.ViewportSaveData.CanvasLayout.Types)
            {
                TypeLayoutData copyOfOldType = oldType;
                AssociationData association = oldDiagram.ViewportSaveData.Subject.Associations.FirstOrDefault(x => x.AssociatedTo.Id == copyOfOldType.Id);
                if (association == null)
                {
                    if (oldDiagram.ViewportSaveData.Subject.Implements != null)
                    {
                        association = oldDiagram.ViewportSaveData.Subject.Implements.FirstOrDefault(x => x.AssociatedTo.Id == oldType.Id);
                    }

                    if (association == null && oldDiagram.ViewportSaveData.Subject.Parent != null)
                    {
                        association = oldDiagram.ViewportSaveData.Subject.Parent.AssociatedTo.Id == oldType.Id ? oldDiagram.ViewportSaveData.Subject.Parent : null;
                    }
                }

                if (association == null)
                {
                    throw new NotSupportedException("Association Id " + oldType.Id + " not found in the Subject's data. Cannot deserialise from this data.");
                }

                var newType = new Persistence.TypeLayoutData { Id = oldType.Id.ToString(), TopLeft = oldType.TopLeft, Visible = oldType.Visible, ContentType = association.GetType().FullName, };
                canvasLayoutv105.Types.Add(newType);
            }
        }
Exemple #9
0
 public SecurityEnforcer(Persistence.IPersister persister, ISecurityManager security, Definitions.IDefinitionManager definitions, Web.IUrlParser urlParser, Web.IWebContext webContext)
 {
     this.webContext = webContext;
     this.persister = persister;
     this.security = security;
     this.definitions = definitions;
     this.urlParser = urlParser;
 }
Exemple #10
0
 public static Persistence getInstance()
 {
     if(_instance == null)
     {
         _instance = GameObject.FindObjectOfType<Persistence>();
     }
     return _instance;
 }
Exemple #11
0
 public SecurityEnforcer(Persistence.IPersister persister, ISecurityManager security, ContentActivator activator, Web.IUrlParser urlParser, Web.IWebContext webContext)
 {
     this.webContext = webContext;
     this.persister = persister;
     this.security = security;
     this.activator = activator;
     this.urlParser = urlParser;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Recommendation"/> class.
 /// </summary>
 /// <param name="recommendation">The recommendation.</param>
 public Recommendation(Persistence.Recommendation recommendation)
 {
     this.ID = recommendation.ID;
     this.UserID = recommendation.UserID;
     this.OperatingSystem = recommendation.OSID;
     this.Description = recommendation.Description;
     this.AppName = recommendation.AppDesignation;
 }
Exemple #13
0
        public void Export(Persistence.Lookup settings)
        {
            if (mName == null) return;

            settings.Add("Name", mName);

            settings.Add("Criteria", mElements);
        }
Exemple #14
0
 public void Import(Persistence.Lookup settings)
 {
     mKey = new MotiveKey(
         settings.GetEnum<CASAgeGenderFlags>("AgeSpecies", CASAgeGenderFlags.None),
         settings.GetEnum<OccultTypes>("Occult", OccultTypes.None),
         settings.GetEnum<CommodityKind>("Commodity", CommodityKind.None)
     );
     mValue = settings.GetFloat("Value", 1);
 }
Exemple #15
0
 public SecurityEnforcer(Persistence.IPersister persister, ISecurityManager security, ContentActivator activator, Web.IUrlParser urlParser, Web.IWebContext webContext, Configuration.HostSection config)
 {
     this.webContext = webContext;
     this.persister = persister;
     this.security = security;
     this.activator = activator;
     this.urlParser = urlParser;
     this.permissionDeniedHttpCode = config.Web.PermissionDeniedHttpCode;
 }
Exemple #16
0
        public override void Export(Persistence.Lookup settings)
        {
            base.Export(settings);

            if (mValue != null)
            {
                settings.Add("Value", mValue.ToString());
            }
        }
Exemple #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="User"/> class.
 /// </summary>
 /// <param name="user">The user.</param>
 public User(Persistence.User user)
 {
     this.ID = user.ID;
     this.FirstName = user.FirstName;
     this.Lastname = user.LastName;
     this.Children = user.Children;
     this.CountryOfOriginID = user.CountryOfOriginID;
     this.IsAdmin = user.Admin != null;
 }
 /// <summary>
 /// Initializes a new instance of Recention
 /// </summary>
 /// <param name="recention">The recention (Database entity)</param>
 internal Recention(Persistence.Recention recention)
 {
     this.ID = recention.ID;
     this.Rating = recention.Rating;
     this.Comment = recention.Comment;
     this.Date = recention.Date;
     this.User = string.Format("{0} {1}", recention.User.FirstName , recention.User.LastName);
     this.UserID = recention.UserID;
     this.AppID = recention.AppID;
 }
        /// <summary>
        /// Loads service object fields values (parameter) into the current business object 
        /// fields. Curent business object is a transient one. It may be persisted some time
        /// somewhere but for the moment we assume it is not and deal with it like transient.
        /// </summary>
        /// <param name="entity">The source.</param>
        protected void DataPortal_Create(Persistence.Model.VacationRequestEntity entity)
        {
            _requestNumber = entity.Id;
            _submissionDate = entity.CreationDate;
            _stateId = entity.State;
            _employeeFullName = entity.Employee.Firstname + " " + entity.Employee.LastName;

            EmployeeId = entity.Employee.Id;
            StartDate = entity.StartDate;
            EndDate = entity.EndDate;
        }
 protected override void Commit(XElement item)
 {
     // Save it
     using (Persistence oDB = new Persistence())
     {
         Persistence.ParameterCollection parameters = new Persistence.ParameterCollection();
         parameters.Add("InputXml");
         parameters[0].Value = item.ToString();
         oDB.Execute("Masters_ConnectionString", "SaveSeniorData", parameters);
     }
 }
Exemple #21
0
        public override void Import(Persistence.Lookup settings)
        {
            base.Import(settings);

            FieldInfo field = GetFieldInfo();
            if (field != null)
            {
                ITunableConvertOption converter = TunableTypeOption.GetFieldOption(GetParsingType(field));
                if (converter != null)
                {
                    mValue = converter.Clone(GetTunableFieldInfo ()).Convert(settings.GetString("Value"), false);
                }
            }
        }
Exemple #22
0
 private static void ConvertLayoutAnnotations(TypeVisualiserLayoutFile oldDiagram, Persistence.CanvasLayoutData canvasLayoutv105)
 {
     foreach (AnnotationData oldAnnotation in oldDiagram.ViewportSaveData.CanvasLayout.Annotations)
     {
         canvasLayoutv105.Types.Add(new Persistence.TypeLayoutData
                                        {
                                            ContentType = typeof(Persistence.AnnotationData).FullName,
                                            Id = oldAnnotation.Id.ToString(),
                                            TopLeft = oldAnnotation.TopLeft,
                                            Visible = oldAnnotation.Show,
                                            Data = oldAnnotation.Text,
                                        });
     }
 }
Exemple #23
0
        public static Dto.Photo ToDto(Pst.Photo domain)
        {
            if (domain == null)
            {
                return null;
            }

            return new Dto.Photo()
            {
                Id = domain.Id,
                Url = domain.Url,
                ThumbnailUrl = domain.ThumbnailUrl,
                Description = domain.Description
            };
        }
Exemple #24
0
        public Tracker(Persistence.IPersister persister, IRepository<ContentDetail> detailRepository, N2.Web.IUrlParser urlParser, ConnectionMonitor connections, N2.Web.IErrorNotifier errorHandler)
        {
            this.persister = persister;
            this.detailRepository = detailRepository;
            this.urlParser = urlParser;
            this.errorHandler = errorHandler;

            connections.Online += delegate
            {
                persister.ItemSaving += persister_ItemSaving;
            };
            connections.Offline += delegate
            {
                persister.ItemSaving -= persister_ItemSaving;
            };
        }
        public static void loadProviderFromAssembly(
            String fullAssemblyFile,
            String typeName,
            String traceEntityTypeName,
            ref Persistence.DataBase.IDataBasePersistence dataBasePersistence,
            ref System.Type traceEntityType
            )
        {
            try
                    {
                        System.Reflection.Assembly  assembly = System.Reflection.Assembly.LoadFile( fullAssemblyFile );

                        dataBasePersistence = assembly.CreateInstance(typeName) as Persistence.DataBase.IDataBasePersistence;
                        traceEntityType     = assembly.CreateInstance(traceEntityTypeName).GetType();

                        if( (null == dataBasePersistence) || (null == traceEntityType) )
                        {
                            throw new Exceptions.NoProviderFoundInAssembly
                            (
                                String.Format
                                (
                                    "assemblyFile: {0}, typeName: {1}, traceEntityTypeName: {2}",
                                    fullAssemblyFile,
                                    typeName,
                                    traceEntityTypeName
                                )
                            );
                        }
                    }
                    #region Disable some nasty crashes
                    catch( System.Exception e )
                    {
                        throw new Exceptions.NoProviderFoundInAssembly
                        (
                            String.Format
                            (
                                "assemblyFile: {0}, typeName: {1}, additionalError: {2}",
                                fullAssemblyFile,
                                typeName,
                                e.ToString()
                            )
                        );
                    }
                    #endregion
        }
Exemple #26
0
        public Tracker(Persistence.IPersister persister, N2.Web.IUrlParser urlParser, ConnectionMonitor connections, N2.Web.IErrorNotifier errorHandler, Configuration.EditSection config)
		{
			this.repository = persister.Repository;
			this.urlParser = urlParser;
            this.errorHandler = errorHandler;

			if (config.LinkTracker.Enabled)
			{
				connections.Online += delegate
				{
					persister.ItemSaving += persister_ItemSaving;
				};
				connections.Offline += delegate
				{
					persister.ItemSaving -= persister_ItemSaving;
				};
			}
		}
Exemple #27
0
        public Game(IConsoleView console)
        {
            _mapPersistence = new Persistence<Map>();

              if (File.Exists(MapFile))
              {
            _map = _mapPersistence.Load(MapFile);
              }
              else
              {
            _map = new Map();
            var generator = new Generator(_map);
            generator.GenerateLevel();
            _mapPersistence.Save(_map, MapFile);
              }

              Console = console;
              Console.HideCursor();
        }
        protected void DataPortal_Create(Persistence.Model.EmployeeEntity entity)
        {
            EmployeeId = entity.Id;
            FirstName = entity.Firstname;
            LastName = entity.LastName;

            PhoneNumber = entity.PhoneNumber;
            Address = entity.Address;
            Email = entity.Email;

            Cnp = entity.Cnp;
            BirthDate = entity.BirthDate;
            HireDate = entity.HireDate;

            Roles = entity.Roles;

            if (entity.Manager != null)
                _managerFullName = entity.Manager.Firstname + " " + entity.Manager.LastName;
        }
        public void Commit_AzureBlobThrowsException_ShouldRollbackAllAndLog(
            [Frozen]Mock<ILogger> logger,
            [Frozen]Mock<IEntityFrameworkContext> efContext,
            [Frozen]Mock<IAzureQueueContext> aqContext,
            [Frozen]Mock<IAzureTableContext> atContext,
            [Frozen]Mock<IAzureBlobContext> abContext,
            Persistence.UnitOfWork uow)
        {
            // Arrange

            var exception = new Exception("Exception");

            abContext.Setup(c => c.SaveChanges()).Throws(exception);

            // Act

            var assertException = Assert.Throws<Exception>(() => uow.Commit());

            assertException.Message.Should().Be("Exception");

            // Assert

            logger.Verify(l => l.Log("Exception caught: Exception"), Times.Once);

            abContext.Verify(c => c.SaveChanges(), Times.Once);
            atContext.Verify(c => c.SaveChanges(), Times.Never);
            aqContext.Verify(c => c.SaveChanges(), Times.Never);
            efContext.Verify(c => c.SaveChanges(), Times.Never);

            logger.Verify(l => l.Log("Azure Blob context commited."), Times.Never);
            logger.Verify(l => l.Log("Azure Table context commited."), Times.Never);
            logger.Verify(l => l.Log("Azure Queue context commited."), Times.Never);
            logger.Verify(l => l.Log("Entity Framework context commited."), Times.Never);

            aqContext.Verify(c => c.Rollback(), Times.Once);
            atContext.Verify(c => c.Rollback(), Times.Once);
            abContext.Verify(c => c.Rollback(), Times.Once);

            logger.Verify(l => l.Log("Executing Azure Queue context rollback..."), Times.Once);
            logger.Verify(l => l.Log("Executing Azure Table context rollback..."), Times.Once);
            logger.Verify(l => l.Log("Executing Azure Blob context rollback..."), Times.Once);
        }
        /// <summary>
        /// Sets the specified collection view.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="collection">The collection.</param>
        /// <param name="persistence">The persistence.</param>
        public string Set(string key, List<Media> collection, Persistence persistence)
        {
            byte[] bytes = System.Text.Encoding.Default.GetBytes(key);
            string encodedKey = HexEncoding.ToString(bytes);

            IEnumerable<int> ids = collection.Select(m => m.MediaId);
            string idCollection = string.Join(",", ids);

            PersistentCollection collection1 = _persistentCollectionRepository.Get(key);

            if (collection1 == null || collection1.Value != idCollection)
            {
                PersistentCollection persistentCollection = new PersistentCollection
                                                          {
                                                              CollectionKey = key,
                                                              Persistence = persistence,
                                                              Value = idCollection
                                                          };

                _persistentCollectionRepository.Set(persistentCollection);
            }

            return encodedKey;
        }
        public bool HasUsername(string username)
        {
            List <string[]> searchedResult = Persistence.ReadEntryByKey(path, username, PeopleConstants.USERNAME_COLUMN);

            return(searchedResult.Count != 0);
        }
 public void should_provide_a_commit_to_the_underlying_infrastructure()
 {
     A.CallTo(() => Persistence.Commit(A <CommitAttempt> ._)).MustHaveHappened(Repeated.Exactly.Once);
 }
Exemple #33
0
 // Start is called before the first frame update
 void Awake()
 {
     Instance = this;
 }
 protected override void Context()
 {
     A.CallTo(() => Persistence.GetFrom(Bucket.Default, streamId, 0, int.MaxValue))
     .Returns(Enumerable.Empty <ICommit>());
 }
 public void should_invoke_the_underlying_infrastructure_with_the_values_provided()
 {
     A.CallTo(() => Persistence.GetFrom(Bucket.Default, streamId, MinRevision, MaxRevision)).MustHaveHappened(Repeated.Exactly.Once);
 }
 public void should_provide_the_commit_attempt_to_the_configured_persistence_mechanism()
 {
     A.CallTo(() => Persistence.Commit(_populatedAttempt)).MustHaveHappened(Repeated.Exactly.Once);
 }
        protected override void Context()
        {
            _committed = BuildCommitStub(1, 1);

            A.CallTo(() => Persistence.GetFrom(Bucket.Default, streamId, 0, int.MaxValue)).Returns(new[] { _committed });
        }
Exemple #38
0
        public object MoveForm(MoveFormRequest request)
        {
            // Variables.
            var result   = default(object);
            var rootId   = CoreConstants.System.Root.ToInvariantString();
            var parentId = GuidHelper.GetGuid(request.NewParentId);


            // Catch all errors.
            try
            {
                // Declare list of anonymous type.
                var savedDescendants = new[]
                {
                    new
                    {
                        Id   = string.Empty,
                        Path = new string[] { }
                    }
                }.Take(0).ToList();


                // Variables.
                var formId        = GuidHelper.GetGuid(request.FormId);
                var form          = Persistence.Retrieve(formId);
                var parentPath    = Entities.Retrieve(parentId).Path;
                var oldFormPath   = form.Path;
                var oldParentPath = oldFormPath.Take(oldFormPath.Length - 1).ToArray();
                var configs       = ConFormPersistence.RetrieveChildren(formId);


                // Move form and configurations.
                var path = EntityHelper.GetClientPath(Entities.MoveEntity(form, parentPath));
                foreach (var config in configs)
                {
                    var descendantParentPath = config.Path.Take(config.Path.Length - 1);
                    var descendantPathEnd    = descendantParentPath.Skip(oldParentPath.Length);
                    var newParentPath        = parentPath.Concat(descendantPathEnd).ToArray();
                    var clientPath           = EntityHelper.GetClientPath(
                        Entities.MoveEntity(config, newParentPath));
                    savedDescendants.Add(new
                    {
                        Id   = GuidHelper.GetString(config.Id),
                        Path = clientPath
                    });
                }


                // Success.
                result = new
                {
                    Success     = true,
                    Id          = GuidHelper.GetString(formId),
                    Path        = path,
                    Descendants = savedDescendants.ToArray()
                };
            }
            catch (Exception ex)
            {
                // Error.
                LogHelper.Error <FormsController>(MoveFormError, ex);
                result = new
                {
                    Success = false,
                    Reason  = UnhandledError
                };
            }


            // Return result.
            return(result);
        }
Exemple #39
0
        public object PersistForm(PersistFormRequest request)
        {
            // Variables.
            var result      = default(object);
            var formsRootId = GuidHelper.GetGuid(FormConstants.Id);
            var parentId    = GuidHelper.GetGuid(request.ParentId);


            // Catch all errors.
            try
            {
                // Parse or create the form ID.
                var formId = string.IsNullOrWhiteSpace(request.FormId)
                    ? Guid.NewGuid()
                    : GuidHelper.GetGuid(request.FormId);


                // Get the fields.
                var fields = request.Fields.MakeSafe()
                             .Select(x =>
                {
                    var fieldType    = Type.GetType(x.TypeFullName);
                    var genericType  = typeof(FormField <>);
                    var specificType =
                        genericType.MakeGenericType(new[] { fieldType });
                    var field = Activator.CreateInstance(specificType)
                                as IFormField;
                    field.Id = string.IsNullOrWhiteSpace(x.Id)
                            ? Guid.NewGuid()
                            : GuidHelper.GetGuid(x.Id);
                    field.Alias       = x.Alias;
                    field.Name        = x.Name;
                    field.Label       = x.Label;
                    field.Category    = x.Category;
                    field.Validations = x.Validations.MakeSafe()
                                        .Select(y => GuidHelper.GetGuid(y)).ToArray();
                    field.FieldConfiguration =
                        JsonHelper.Serialize(x.Configuration);
                    return(field);
                })
                             .ToArray();


                // Get the handlers.
                var handlers = request.Handlers.MakeSafe().Select(x =>
                {
                    var handlerType  = Type.GetType(x.TypeFullName);
                    var genericType  = typeof(FormHandler <>);
                    var specificType =
                        genericType.MakeGenericType(new[] { handlerType });
                    var handler = Activator.CreateInstance(specificType)
                                  as IFormHandler;
                    handler.Id = string.IsNullOrWhiteSpace(x.Id)
                        ? Guid.NewGuid()
                        : GuidHelper.GetGuid(x.Id);
                    handler.Alias   = x.Alias;
                    handler.Name    = x.Name;
                    handler.Enabled = x.Enabled;
                    handler.HandlerConfiguration =
                        JsonHelper.Serialize(x.Configuration);
                    return(handler);
                }).ToArray();


                // Get the ID path.
                var parent = parentId == Guid.Empty ? null : Entities.Retrieve(parentId);
                var path   = parent == null
                    ? new[] { formsRootId, formId }
                    : parent.Path.Concat(new[] { formId }).ToArray();


                // Create the form.
                var form = new Form()
                {
                    Id       = formId,
                    Path     = path,
                    Alias    = request.Alias,
                    Name     = request.Name,
                    Fields   = fields,
                    Handlers = handlers
                };


                // Persist the form.
                Persistence.Persist(form);


                // Success.
                result = new
                {
                    Success = true,
                    FormId  = GuidHelper.GetString(formId)
                };
            }
            catch (Exception ex)
            {
                // Error.
                LogHelper.Error <FormsController>(PersistFormError, ex);
                result = new
                {
                    Success = false,
                    Reason  = UnhandledError
                };
            }


            // Return the result.
            return(result);
        }
 public void should_provide_a_commit_to_the_underlying_infrastructure()
 {
     Persistence.Verify(x => x.Commit(It.IsAny <Commit>()), Times.Once());
 }
 public void should_not_call_the_underlying_infrastructure()
 {
     Persistence.Verify(x => x.Commit(It.IsAny <Commit>()), Times.Never());
 }
Exemple #42
0
 async Task PersistTeacherBookmarks()
 {
     await Persistence.PersistTeacherBookmarks(TeacherBookmarks.ToList());
 }
Exemple #43
0
 async Task PersistSchoolClassBookmarks()
 {
     await Persistence.PersistSchoolClassBookmarks(AllSchoolClassBookmarks.ToList());
 }
Exemple #44
0
 async Task PersistSchoolBookmarks()
 {
     await Persistence.PersistSchoolBookmarks(SchoolBookmarks.ToList());
 }
 public void should_dispose_the_underlying_persistence()
 {
     A.CallTo(() => Persistence.Dispose()).MustHaveHappened(Repeated.Exactly.Once);
 }
Exemple #46
0
        public object GetFormInfo([FromUri] GetFormInfoRequest request)
        {
            // Variables.
            var result = default(object);
            var rootId = CoreConstants.System.Root.ToInvariantString();


            // Catch all errors.
            try
            {
                // Variables.
                var id       = GuidHelper.GetGuid(request.FormId);
                var form     = Persistence.Retrieve(id);
                var fullPath = new[] { rootId }
                .Concat(form.Path.Select(x => GuidHelper.GetString(x)))
                .ToArray();


                // Set result.
                result = new
                {
                    Success = true,
                    FormId  = GuidHelper.GetString(form.Id),
                    Path    = fullPath,
                    Alias   = form.Alias,
                    Name    = form.Name,
                    Fields  = form.Fields.MakeSafe().Select(x => new
                    {
                        Id = GuidHelper.GetString(x.Id),
                        x.Alias,
                        x.Name,
                        x.Label,
                        x.Category,
                        x.IsServerSideOnly,
                        Validations = x.Validations.MakeSafe()
                                      .Select(y => Validations.Retrieve(y))
                                      .WithoutNulls()
                                      .Select(y => new
                        {
                            Id   = GuidHelper.GetString(y.Id),
                            Name = y.Name
                        }).ToArray(),
                        Configuration = JsonHelper.Deserialize <object>(
                            x.FieldConfiguration),
                        Directive    = x.GetDirective(),
                        Icon         = x.GetIcon(),
                        TypeLabel    = x.GetTypeLabel(),
                        TypeFullName = x.GetFieldType().AssemblyQualifiedName
                    }).ToArray(),
                    Handlers = form.Handlers.MakeSafe().Select(x => new
                    {
                        Id = GuidHelper.GetString(x.Id),
                        x.Alias,
                        x.Name,
                        x.Enabled,
                        Configuration = JsonHelper.Deserialize <object>(
                            x.HandlerConfiguration),
                        Directive    = x.GetDirective(),
                        Icon         = x.GetIcon(),
                        TypeLabel    = x.GetTypeLabel(),
                        TypeFullName = x.GetHandlerType().AssemblyQualifiedName
                    }).ToArray()
                };
            }
            catch (Exception ex)
            {
                // Error.
                LogHelper.Error <FormsController>(GetFormInfoError, ex);
                result = new
                {
                    Success = false,
                    Reason  = UnhandledError
                };
            }


            // Return result.
            return(result);
        }
 public void should_not_call_the_underlying_infrastructure()
 {
     A.CallTo(() => Persistence.Commit(_attempt)).MustNotHaveHappened();
 }
Exemple #48
0
 public AtLeastOnceDeliveryFailureSpec()
     : base(FailureSpecConfig.WithFallback(Persistence.DefaultConfig()))
 {
 }
 public void should_pass_the_maximum_possible_revision_to_the_persistence_infrastructure()
 {
     A.CallTo(() => Persistence.GetFrom(Bucket.Default, streamId, snapshot.StreamRevision, int.MaxValue)).MustHaveHappened(Repeated.Exactly.Once);
 }
Exemple #50
0
 public OrderActor(IProvider provider, string persistenceId)
 {
     _behavior    = new Behavior();
     _persistence = Persistence.WithEventSourcing(provider, persistenceId, ApplyEvent);
 }
 public void should_pass_a_revision_range_to_the_persistence_infrastructure()
 {
     A.CallTo(() => Persistence.GetFrom(Bucket.Default, streamId, 0, int.MaxValue)).MustHaveHappened(Repeated.Exactly.Once);
 }
Exemple #52
0
 public MyPersistenceActor(IProvider provider)
 {
     _persistence = Persistence.WithEventSourcingAndSnapshotting(provider, provider, "demo-app-id", Apply, Apply);
 }
 public void should_query_the_underlying_storage_using_the_revision_of_the_snapshot()
 {
     A.CallTo(() => Persistence.GetFrom(Bucket.Default, streamId, 42, MaxRevision)).MustHaveHappened(Repeated.Exactly.Once);
 }
Exemple #54
0
 public IQueryable <BookGenre> GetAllGenres() => Persistence.Query <BookGenre>().OrderBy(_ => _.Code);
 public void should_query_the_underlying_storage_to_discover_the_new_commits()
 {
     A.CallTo(() => Persistence.GetFrom(BucketId, StreamId, StreamRevision + 1, int.MaxValue)).MustHaveHappened(Repeated.Exactly.Once);
 }
Exemple #56
0
 public Book GetBookById(Guid id) => Persistence.GetById <Book>(id);
Exemple #57
0
        protected override Entity findEntity(long id)
        {
            infoformentity = Persistence.Read <Lokasyon>(id);

            return((Lokasyon)infoformentity);
        }
 protected override void Context()
 {
     A.CallTo(() => Persistence.GetFrom(Bucket.Default, streamId, 0, 0)).Returns(new ICommit[0]);
 }
 public bool Delete(uint id)
 {
     return(Persistence.RemoveEntry(path, id.ToString()));
 }
 public void should_query_the_underlying_storage_to_discover_the_new_commits()
 {
     Persistence.Verify(x => x.GetFrom(Bucket.Default, streamId, StreamRevision + 1, int.MaxValue), Times.Once());
 }