Esempio n. 1
0
        public Commit(ICommitId id) {
            Id = id;

            AddedPocos = new List<AddedPoco>();
            UpdatedPocos = new List<Tuple<IPocoId, SetProperty>>();
            CollectionAdditions = new List<CollectionAddition>();
            CollectionRemovals = new List<CollectionRemoval>();
        }
Esempio n. 2
0
        public int CompareTo(ICommitId other) {
            var otherId = other as CommitId;

            if (otherId == null)
                return 0;

            var createdCompare = Created.CompareTo(otherId.Created);

            return createdCompare != 0 ? createdCompare : Id.CompareTo(otherId.Id);
        }
Esempio n. 3
0
        public ICommit Get(ICommitId id) {
            if (id == null)
                throw new ArgumentNullException("id");

            var serialisedId = Serializer.Serialize(id);

            using (var connection = DbConnectionFactory.CreateOpenConnection())
            using (var command = connection.CreateCommand()) {
                command.CommandText = "SELECT Value FROM SqlCommits WHERE Id = @Id";
                command.Parameters.Add(command.CreateParameter());
                command.Parameters[0].ParameterName = "Id";
                command.Parameters[0].Value = serialisedId;

                string value;
                using (var result = command.ExecuteReader()) {
                    if (!result.Read())
                        return null;

                    value = result["Value"].ToString();
                }

                return Serializer.Deserialize<ICommit>(value);
            }
        }
Esempio n. 4
0
 public ICommit Get(ICommitId id) {
     return Commits.Where(c => c.Id == id).FirstOrDefault();
 }