Exemplo n.º 1
0
        /// <summary>
        /// When an entity is attempted to be created without an id, and an Id was passed in for that particular entity type, the Guid of the Id will be used to populate the entity
        /// </summary>
        /// <param name="ids">The ids.</param>
        /// <returns></returns>
        public TDerived WithIdsDefaultedForCreate(IEnumerable <Id> ids)
        {
            foreach (var id in ids)
            {
                NewEntityDefaultIds.AddOrEnqueue(id);
            }

            return(This);
        }
        /// <summary>
        /// When an entity is attempted to be created without an id, and an Id was passed in for that particular entity type, the Guid of the Id will be used to populate the entity
        /// </summary>
        /// <param name="ids">The ids.</param>
        /// <param name="ignoreContextCreation">Since OrganizationServiceContext.SaveChanges will populate ids if they aren't already populated, controls whether an error should be thrown when this occurs.</param>
        /// <returns></returns>
        public TDerived WithIdsDefaultedForCreate(IEnumerable <Id> ids, bool ignoreContextCreation = false)
        {
            if (ignoreContextCreation)
            {
                NewEntityThrowErrorOnContextCreation = false;
            }
            foreach (var id in ids)
            {
                NewEntityDefaultIds.AddOrEnqueue(id);
            }

            return(This);
        }