Exemple #1
0
        /// <summary>
        /// Creates a new record/document in the repository.
        /// </summary>
        /// <param name="identifier">Unique identifier of the record/repository</param>
        /// <param name="data">Data object.</param>
        public void Create(string identifier, T data)
        {
            lock (mutex)
            {
                if (data != null)
                {
                    if (string.IsNullOrEmpty(identifier))
                    {
                        identifier = DataHelpers.CreateUid().ToString();
                    }

                    data._EntityId = identifier.Trim();
                    OnCreate?.Invoke(identifier, data);
                }

                CreateNvi(identifier, data);
            }
        }
Exemple #2
0
        /// <summary>
        /// Creates a new record/document in the repository.
        /// </summary>
        /// <param name="identifier">Unique identifier of the record/repository</param>
        /// <param name="data">Data object.</param>
        public void Create(string identifier, T data)
        {
            lock (mutex)
            {
                if (data != null)
                {
                    if (string.IsNullOrEmpty(identifier))
                    {
                        identifier = DataHelpers.CreateUid().ToString();
                    }

                    data._EntityId = identifier;
                    data._Created  = DateTimeProviders.DateTimeProvider.Now;
                    data._Modified = data._Created;
                }

                CreateNvi(identifier, data);
            }
        }