BExIS.Dlm.Services.Data.DatasetManager.CreateDataTuple C# (CSharp) Метод

CreateDataTuple() публичный Метод

Using the provided values creates a data tuple, attaches it to the version and persists it in the database. This method does not affect the status of the dataset version.
throws and exception if the dataset version is not checked-out.
public CreateDataTuple ( int orderNo, ICollection variableValues, ICollection amendments, DatasetVersion datasetVersion ) : DataTuple
orderNo int The order of the data tuple in the list of tuples
variableValues ICollection The values to be considered as the data tuple. They must be attached to their corresponding variables according to the dataset's data structure.
amendments ICollection Each data tuple can have amendments and if provided, the method attaches them to the data tuple.
datasetVersion BExIS.Dlm.Entities.Data.DatasetVersion The version of the dataset the data tuple is attached to. The version must be checked-out.
Результат BExIS.Dlm.Entities.Data.DataTuple
        public DataTuple CreateDataTuple(int orderNo, ICollection<VariableValue> variableValues, ICollection<Amendment> amendments, DatasetVersion datasetVersion)
        {
            //Contract.Requires(!string.IsNullOrWhiteSpace(name));
            Contract.Requires(datasetVersion != null);

            Contract.Ensures(Contract.Result<DataTuple>() != null && Contract.Result<DataTuple>().Id >= 0);
            if (datasetVersion.Status != DatasetVersionStatus.CheckedOut)
            {
                throw new Exception(string.Format("The dataset version {0} must be checked-out!", datasetVersion.Id));
            }

            DataTuple e = new DataTuple()
            {
                OrderNo = orderNo,
                DatasetVersion = datasetVersion,
                VariableValues = new List<VariableValue>(variableValues),
                Amendments = new List<Amendment>(amendments),
            };
            e.DatasetVersion.PriliminaryTuples.Add(e);
            e.Amendments.ToList().ForEach(ex => ex.Tuple = e);
            //e.VariableValues.ToList().ForEach(ex => ex.Tuple = e);

            // check to see if all variable values and their parameter values are defined in the data structure
            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<DataTuple> repo = uow.GetRepository<DataTuple>();
                repo.Put(e);
                uow.Commit();
            }
            return (e);
        }