Esempio n. 1
0
        public string GetModifiedReason(IProjection projection)
        {
            if (projection == null || projection is ICheckpointStore)
            {
                return(string.Empty);
            }
            try
            {
                var dto = collection.AsQueryable().FirstOrDefault(x => x.ProjectionName == GetName(projection));

                if (dto == null)
                {
                    return("Version is absent");
                }
                if (dto.Version != projection.Version)
                {
                    return("Version is different");
                }
                if (dto.Hash != StructureHash.CalculateMD5(projection))
                {
                    return("Hash is different");
                }
                return(string.Empty);
            }
            catch (Exception ex)
            {
                if (ex is SqlException || ex.Message.Contains("Invalid column name"))
                {
                    return("Invalid column name");
                }

                throw;
            }
        }
Esempio n. 2
0
        public void MarkAsUnmodified(IProjection projection)
        {
            string name = GetName(projection);

            var dto = collection.AsQueryable().FirstOrDefault(x => x.ProjectionName == GetName(projection)) ?? new ProjectionVersionDto();

            dto.ProjectionName = name;
            dto.Version        = projection.Version;
            dto.ChangeDate     = DateTime.UtcNow;
            dto.Hash           = StructureHash.CalculateMD5(projection);

            collection.Save(dto);
        }
        public void MarkAsUnmodified(IProjection projection)
        {
            string name = GetName(projection);

            using (var con = db.OpenDbConnection())
            {
                var dto = con.FirstOrDefault <ProjectionVersionDto>(x => x.ProjectionName == name) ?? new ProjectionVersionDto();

                dto.ProjectionName = name;
                dto.Version        = projection.Version;
                dto.ChangeDate     = DateTime.UtcNow;
                dto.Hash           = StructureHash.CalculateMD5(projection);

                con.Save(dto);
            }
        }