BExIS.Dlm.Entities.Data.DataTuple.Materialize C# (CSharp) Method

Materialize() public method

public Materialize ( bool includeChildren = true ) : void
includeChildren bool
return void
        public override void Materialize(bool includeChildren = true)
        {
            base.Materialize();
            VariableValues.ToList().ForEach(p => p.Tuple = this);
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// create a new dataset, check it out to create the first version, add a tuple to it.
        /// </summary>
        /// <returns></returns>
        private Int64 createDatasetVersion()
        {
            DataStructureManager dsManager = new DataStructureManager();
            ResearchPlanManager rpManager = new ResearchPlanManager();
            DatasetManager dm = new DatasetManager();

            MetadataStructureManager mdsManager = new MetadataStructureManager();
            MDS.MetadataStructure mds = mdsManager.Repo.Query().First();

            Dataset ds = dm.CreateEmptyDataset(dsManager.StructuredDataStructureRepo.Get(1), rpManager.Repo.Get(1), mds);

            if (dm.IsDatasetCheckedOutFor(ds.Id, "Javad") || dm.CheckOutDataset(ds.Id, "Javad"))
            {
                DatasetVersion workingCopy = dm.GetDatasetWorkingCopy(ds.Id);

                //DataTuple changed = dm.GetDatasetVersionEffectiveTuples(workingCopy).First();
                //changed.VariableValues.First().Value = (new Random()).Next().ToString();
                DataTuple dt = dm.DataTupleRepo.Get(1); // its sample data
                List<DataTuple> tuples = new List<DataTuple>();
                for (int i = 0; i < 10000; i++)
                {
                    DataTuple newDt = new DataTuple();
                    newDt.XmlAmendments = dt.XmlAmendments;
                    newDt.XmlVariableValues = dt.XmlVariableValues; // in normal cases, the VariableValues are set and then Dematerialize is called
                    newDt.Materialize();
                    newDt.OrderNo = i;
                    //newDt.TupleAction = TupleAction.Created;//not required
                    //newDt.Timestamp = DateTime.UtcNow; //required? no, its set in the Edit
                    //newDt.DatasetVersion = workingCopy;//required? no, its set in the Edit
                    tuples.Add(newDt);
                }
                dm.EditDatasetVersion(workingCopy, tuples, null, null);
                dm.CheckInDataset(ds.Id, "for testing purposes", "Javad");
                dm.DatasetVersionRepo.Evict();
                dm.DataTupleRepo.Evict();
                dm.DatasetRepo.Evict();
                workingCopy.PriliminaryTuples.Clear();
                workingCopy = null;
            }
            var dsId = ds.Id;
            ds = null;
            return (dsId);
        }