public DataView CreateDataView(string name, string contentSelectionCriterion, string containerSelectionCriterion, BExIS.Dlm.Entities.DataStructure.DataStructure dataStructure)
{
Contract.Requires(!string.IsNullOrWhiteSpace(name));
Contract.Requires(!string.IsNullOrWhiteSpace(contentSelectionCriterion) || !string.IsNullOrWhiteSpace(containerSelectionCriterion));
Contract.Requires(dataStructure != null);
Contract.Ensures(Contract.Result<DataView>() != null);
DataView e = new DataView()
{
Name = name,
ContentSelectionCriterion = contentSelectionCriterion,
ContainerSelectionCriterion = containerSelectionCriterion,
Dataset = null,
};
dataStructure.Views.Add(e);
e.DataStructures.Add(dataStructure);
using (IUnitOfWork uow = this.GetUnitOfWork())
{
// maybe there is a need for persisting the data structure also!
IRepository<DataView> repo = uow.GetRepository<DataView>();
repo.Put(e);
uow.Commit();
}
return (e);
}