Example #1
0
        protected override void AddItem(T entity)
        {
            string id;

            if (GetPrimaryKey(entity, out id) && Equals(id, default(string)))
            {
                id = GeneratePrimaryKey();
                SetPrimaryKey(entity, id);
            }

            Client.CreateDocument(entity, id);
        }
Example #2
0
        protected override void AddItem(T entity)
        {
            string id = null;

            if (GetPrimaryKey(entity, out TKey entityId) && GenerateKeyOnAdd && Equals(entityId.ToString(), default(string)))
            {
                id = GeneratePrimaryKey();
                SetCouchDbPrimaryKey(entity, id);
            }

            Client.CreateDocument(entity, id);
        }