Ejemplo n.º 1
0
        public void Invoke_ValidData_AddsDomainToDatabaseWithCorrectValues()
        {
            // prepare
            var domainData = new DomainModel
            {
                Name = "testdomain"
            };

            DataAccess.Models.Domain domainSaved = null;

            var mockedDomainrepository = new Mock <IDomainRepository>();

            mockedDomainrepository.Setup(r => r.Add(It.IsAny <DataAccess.Models.Domain>()))
            .Callback <DataAccess.Models.Domain>(u => domainSaved = u);
            var mockedUnitOfWork = new Mock <IUnitOfWork>();

            var action = new AddNewDomain(mockedDomainrepository.Object, mockedUnitOfWork.Object);

            // action
            action.Invoke(domainData, Guid.NewGuid());

            // assert
            mockedDomainrepository.Verify(r => r.Add(It.IsAny <DataAccess.Models.Domain>()), Times.Once());
            mockedUnitOfWork.Verify(r => r.Save(), Times.Exactly(1));
            Assert.Equal("testdomain", domainSaved.Name);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates new event.
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="location"></param>
 /// <param name="registrationDate"></param>
 /// <param name="completionDate"></param>
 public HandlingEvent(HandlingEventType eventType, DomainModel.Potential.Location.Location location, DateTime registrationDate, DateTime completionDate)
 {
    _eventType = eventType;         
    _completionDate = completionDate;
    _registrationDate = registrationDate;
    _location = location;
 }
        public override void Execute()
        {
            TDomainClass obj = MasterDetailsViewModel.ItemViewModelSelected.DomainObject;

            DomainModel.Delete(obj.Key);
            MasterDetailsViewModel.AfterModelDelete(obj.Key);
        }
Ejemplo n.º 4
0
        public override void Initialise()
        {
            _weaponModelSCDVM = new SelectionControlDVM <WeaponModel, WeaponModelDataViewModel>(
                () => DataObject().WeaponModelId,
                val =>
            {
                DataObject().WeaponModelId = DomainClassBase <WeaponModel> .IdOrNullId(val);
                OnPropertyChanged(nameof(WeaponModelSelected));
            });

            // Selection-control DVM for at kunne se/rette brugte Jewels
            _socketedJewelSCDVM = new SelectionControlDVM <Jewel, JewelDataViewModel>(
                () => SocketedJewelSelectedId,
                val => SocketedJewelSelectedId = val,
                j => j.WeaponId == DataObject().Id);

            // Selection-control DVM for at kunne se/rette frie Jewels
            _freeJewelSCDVM = new SelectionControlDVM <Jewel, JewelDataViewModel>(
                () => FreeJewelSelectedId,
                val => FreeJewelSelectedId = val,
                j => j.WeaponId == null);

            // Command-objekter til hhv. at droppe eller tilføje en Jewel
            _dropJewelCommand = new ReferenceChangeCommand <Jewel>(j => j.WeaponId = null);
            _addJewelCommand  = new AddJewelToWeaponCommand(j => j.WeaponId = DataObject().Id, DataObject(), this);

            SocketedJewelSelectedId = null;
            FreeJewelSelectedId     = null;

            // Da drop/tilføj vil medføre ændringer i Jewel-Cataloget, som udføres
            // fra Command-objekter, vil vi gerne notificeres om dette.
            DomainModel.GetCatalog <Jewel>().CatalogChanged += JewelCatalogChanged;
        }
 public IEnumerable<DomainModel.News> GetNewsForPeriod(DomainModel.NewsPeriodEnum newsPeriod)
 {
     using (var newsRepo = ObjectFactory.GetInstance<INewsRepo>())
     {
         DateTime date = DateTime.Now;
         switch(newsPeriod)
         {
             case NewsPeriodEnum.Month:
                 date.AddMonths(-1);
                 break;
             case NewsPeriodEnum.Week:
                 date.AddDays(-7);
                 break;
             case NewsPeriodEnum.Year:
                 date.AddYears(-1);
                 break;
             case NewsPeriodEnum.All:
                 return Mapper.Map<IEnumerable<domain.News>>(newsRepo.GetAll());
             default:
                 throw new InvalidOperationException("unknown newsPeriodEnum type");
         }
         var news = newsRepo.GetAll().Where(t => t.NewsDate >= date).ToList();
         return Mapper.Map<IEnumerable<domain.News>>(news);
     }
 }
Ejemplo n.º 6
0
        public IActionResult Get(int id, [FromQuery] DomainModel domainModel)
        {
            domainModel.DomainId = id;
            var dm = _idomain.GetDomainFromId(domainModel);

            return(Ok(dm));
        }
        // Constructors

        public UpgradeHintsProcessor(
            HandlerAccessor handlers,
            MappingResolver resolver,
            StoredDomainModel currentDomainModel,
            StoredDomainModel extractedDomainModel,
            StorageModel extractedStorageModel,
            bool autoDetectTypesMovements)
        {
            ArgumentValidator.EnsureArgumentNotNull(handlers, "handlers");
            ArgumentValidator.EnsureArgumentNotNull(resolver, "resolver");
            ArgumentValidator.EnsureArgumentNotNull(currentDomainModel, "currentDomainModel");
            ArgumentValidator.EnsureArgumentNotNull(extractedDomainModel, "extractedDomainModel");
            ArgumentValidator.EnsureArgumentNotNull(extractedStorageModel, "extractedStorageModel");

            typeMapping         = new Dictionary <StoredTypeInfo, StoredTypeInfo>();
            reverseTypeMapping  = new Dictionary <StoredTypeInfo, StoredTypeInfo>();
            fieldMapping        = new Dictionary <StoredFieldInfo, StoredFieldInfo>();
            reverseFieldMapping = new Dictionary <StoredFieldInfo, StoredFieldInfo>();

            this.resolver = resolver;
            nameBuilder   = handlers.NameBuilder;
            domainModel   = handlers.Domain.Model;

            this.extractedStorageModel = extractedStorageModel;

            currentModel = currentDomainModel;
            currentTypes = currentModel.Types.ToDictionary(t => t.UnderlyingType);

            extractedModel = extractedDomainModel;
            extractedTypes = extractedModel.Types.ToDictionary(t => t.UnderlyingType);

            this.autoDetectTypesMovements = autoDetectTypesMovements;
            hints           = new NativeTypeClassifier <UpgradeHint>(true);
            suspiciousTypes = new List <StoredTypeInfo>();
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Get a Collection of all Rooms from one Hotel
 /// </summary>
 /// <param name="p_hotel">Hotelobject with an ID set</param>
 /// <returns>Collection of Rooms.</returns>
 public ICollection<Room> GetCollectionByHotel(DomainModel.Hotel p_hotel)
 {
     using (var context = new FhdwHotelContext())
     {
         return context.Room.Where(r => r.Hotel.ID == p_hotel.ID).ToList();
     }
 }
        private async Task CreateRequest(string domainName)
        {
            HttpResponseMessage response;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(PackageConstants.BackEndDevsUrl);
                client.DefaultRequestHeaders.TryAddWithoutValidation(PackageConstants.ContentTypeHeader, PackageConstants.ContentType);
                var domainModel = new DomainModel {
                    DomainName = domainName
                };

                try
                {
                    response = await client.PostAsJsonAsync(PackageConstants.BackEndDevsPostStatistic, domainModel);
                }
                catch (Exception ex)
                {
                    throw new NotSuccessfullRequestException(ex.Message);
                }

                if (!response.IsSuccessStatusCode)
                {
                    var message = (int)response.StatusCode + response.ReasonPhrase;
                    throw new NotSuccessfullRequestException(message);
                }
            }
        }
        public override void Execute()
        {
            TDomainClass obj = (TDomainClass)MasterDetailsViewModel.DetailsViewModel.DomainObject.Clone();

            DomainModel.Insert(obj);
            MasterDetailsViewModel.AfterModelInsert(obj);
        }
        private void CreateHostDesignerModel(ServiceContract sc)
        {
            hdStore       = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel));
            hdDomainModel = hdStore.GetDomainModel <HostDesignerDomainModel>();
            hdTransaction = hdStore.TransactionManager.BeginTransaction();
            hdModel       = (HostDesignerModel)hdDomainModel.CreateElement(new Partition(hdStore), typeof(HostDesignerModel), null);

            HostApplication app = (HostApplication)hdStore.ElementFactory.CreateElement(HostApplication.DomainClassId);

            app.ImplementationTechnology = new HostDesignerWcfExtensionProvider();

            reference = (ServiceReference)hdStore.ElementFactory.CreateElement(ServiceReference.DomainClassId);

            //mel://[DSLNAMESPACE]\[MODELELEMENTTYPE]\[MODELELEMENT.GUID]@[PROJECT]\[MODELFILE]
            string serviceMoniker = string.Format(@"mel://{0}\{1}\{2}@{3}\{4}",
                                                  sc.GetType().Namespace,
                                                  serviceContractName,
                                                  sc.Id.ToString(),
                                                  serviceContractModelProjectName, serviceContractModelFileName);

            reference.Name = serviceMelReferenceName;
            reference.ServiceImplementationType = new MockModelBusReference(sc);

            app.ServiceDescriptions.Add(reference);
        }
Ejemplo n.º 12
0
 public virtual void CaseArtefact(DomainModel.Ast.Artefact x)
 {
     x.Name.Visit(this);
     x.Bases.ForEach(y => y.Visit(this));
     x.Body.ForEach(a => a.Visit(this));
     x.PropertyDefinitions.ForEach(y => y.Visit(this));
 }
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Clears this instance to its blank/initial state.
        /// </summary>
        /// <exception cref="ReadOnlyException">
        ///  Thrown when a Read Only error condition occurs.
        /// </exception>
        ///-------------------------------------------------------------------------------------------------
        protected virtual void ClearInternal()
        {
            if (IsReadOnly)
            {
                throw new ReadOnlyException();
            }

            var list = new List <IDomainCommand>();

            foreach (var relationship in DomainModel.GetRelationships(SchemaRelationship, Source, End))
            {
                list.Add(new RemoveRelationshipCommand(relationship));
            }

            var session = EnsuresSession();

            try
            {
                Session.Current.Execute(list.ToArray());
            }
            finally
            {
                if (session != null)
                {
                    session.AcceptChanges();
                    session.Dispose();
                }
            }
        }
        public override object Execute(@DatabaseName@OperationContext context)
        {
            var results = context.Provider.GetAll <DomainModel.@ModelName@>();

            return(new Get@ModelName@sResponse {
                @ModelName@s = @[email protected](results)
            });
        public async Task Handle(PingPublisher notification, CancellationToken cancellationToken)
        {
            _logger.LogInformation($"Publish notification=> {notification.Model}");
            //add correlation id
            notification.Controller.HttpContext.Request.Headers.Add(Identifiers.CorrelationId, new StringValues(notification.CorrelationId.ToString()));

            var request = new DomainModel <DomainModels.Business.PingDomain.Ping>
            {
                Header = new MessageHeader
                {
                    CorrelationId = notification.CorrelationId
                },
                Body   = notification.Model,
                Footer = new MessageFooter
                {
                    Sender      = DomainModels.System.Identifiers.PingServiceName,
                    FingerPrint = notification.Controller.ActionDescriptor.Id,
                    Environment = notification.OperationalUnit.Environment,
                    Assembly    = notification.OperationalUnit.Assembly,
                    Route       = JsonConvert.SerializeObject(new Dictionary <string, string> {
                        { Identifiers.MessagePublisherRoute, notification.MiddlewareConfiguration.MessagePublisherRoute }
                    }, Defaults.JsonSerializerSettings),
                    Hint = Enum.GetName(typeof(ResponseHint), ResponseHint.OK)
                }
            };

            await new Function(_logger, DomainModels.System.Identifiers.RetryCount).Decorate(() =>
            {
                return(notification.MessagePublisher.Command(request));
            });
        }
        /// <summary>
        /// c-tor creating the object out of a given domain model.
        /// </summary>
        /// <param name="dm"></param>
        public GameSituationStructure(DomainModel dm)
        {
            //adding gs to the structure
            foreach (Situation si in dm.elements.situations.situationList)
            {
                gameSituations.Add(new GameSituation(si.id));
            }
            //adding competences to the gs in the structure
            foreach (SituationRelation sir in dm.relations.situations.situations)
            {
                foreach (CompetenceSituation cs in sir.competences)
                {
                    getGameSituationById(sir.id).Competences.Add(cs.id);
                }
            }
            //adding successors of the gs - at the moment all gs are successors of all gs
            foreach (GameSituation gs1 in gameSituations)
            {
                foreach (GameSituation gs2 in gameSituations)
                {
                    gs1.Successors.Add(gs2);
                }
            }

            //set initial gs
            initialGameSituation = gameSituations[0];
        }
Ejemplo n.º 17
0
        public static DomainModel GenerateMatrix(RestfulGraphDatabase rgd)
        {
            string key   = "key_get";
            string value = "value";

            DomainModel dm = new DomainModel();

            DomainEntity thomas = new DomainEntity();

            thomas.Properties["name"] = "Thomas Anderson";
            thomas.Location           = ( URI )rgd.CreateNode("{\"name\":\"" + "Thomas Anderson" + "\"}").Metadata.getFirst("Location");
            dm.Add(thomas);

            DomainEntity agent = new DomainEntity();

            agent.Properties["name"] = "Agent Smith";
            agent.Location           = ( URI )rgd.CreateNode("{\"name\":\"" + "Agent Smith" + "\"}").Metadata.getFirst("Location");
            dm.Add(agent);

            dm.NodeIndexName             = "matrixal-nodes";
            dm.IndexedNodeKeyValues[key] = value;

            dm.IndexedNodeUriToEntityMap[( URI )rgd.AddToNodeIndex(dm.NodeIndexName, null, null, "{\"key\": \"" + key + "\", \"value\":\"" + value + "\", \"uri\": \"" + thomas.Location + "\"}").Metadata.getFirst("Location")] = thomas;
            dm.IndexedNodeUriToEntityMap[( URI )rgd.AddToNodeIndex(dm.NodeIndexName, null, null, "{\"key\": \"" + key + "\", \"value\":\"" + value + "\", \"uri\": \"" + agent.Location + "\"}").Metadata.getFirst("Location")]  = agent;

            return(dm);
        }
Ejemplo n.º 18
0
        public Merge MapToMerge(DomainModel Domain)
        {
            var Merge = new Merge();

            MapMerge(Domain, Merge);
            return(Merge);
        }
Ejemplo n.º 19
0
        public Add MapToAdd(DomainModel Domain)
        {
            var Add = new Add();

            MapAddUpdate(Domain, Add as AddUpdateBase);
            return(Add);
        }
Ejemplo n.º 20
0
        public EntityValidator(DomainModel domainModel)
        {
            FullName aggregateName = new FullName();

            // Ensure entity doesn't have a schema of auth.
            RuleFor(entity => entity.Schema)
            .Must(schema => !schema.IsAuthSchema())
            .WithMessage(entity => $"Entity '{entity.FullName}' uses the reserved schema '{SystemConventions.AuthSchema}'.");

            // Ensure entity is assigned to a valid aggregate
            RuleFor(entity => entity.FullName)
            .Must(entityName => domainModel.AggregateFullNameByEntityFullName.TryGetValue(entityName, out aggregateName))
            .WithMessage("Entity '{PropertyValue}' not assigned to any aggregate.");

            // Ensure that each Entity's FullName.Schema are located in the Schemas in the DomainModel
            RuleFor(entity => entity)
            .Must(entity => domainModel.Schemas.Any(sc => sc.PhysicalName.Equals(entity.FullName.Schema)))
            .WithMessage(entity => $"Entity '{entity.FullName}' uses an undefined schema.");

            // If entity is not assigned to an aggregate, return
            if (string.Equals(aggregateName.ToString(), "."))
            {
                return;
            }

            // Ensure aggregate returned above is a valid aggregate within the domain model
            RuleFor(a => aggregateName)
            .Must(entityName => domainModel.AggregateByName.ContainsKey(aggregateName))
            .WithMessage("Aggregate '{PropertyValue}' not found in domain model.");
        }
        /// <summary>
        /// Resolves address and reads the <see cref="DomainModel"/> record as an asynchronous operation.
        /// </summary>
        /// <param name="modelUri">The model URI.</param>
        /// <param name="rootZoneUrl">The root zone URL where the resolving process shall start.</param>
        /// <param name="log"><see cref="Action{T1, T2, T3}"/> encapsulating tracing functionality .</param>
        /// <returns>Task{DomainModel}.</returns>
        /// <exception cref="InvalidOperationException">Too many iteration in the resolving process.</exception>
        public async Task <DomainModel> ResolveDomainModelAsync(Uri modelUri, Uri rootZoneUrl, Action <string, TraceEventType, Priority> log)
        {
            log($"Starting resolving address of the domain model descriptor for the model Uri {modelUri}", TraceEventType.Verbose, Priority.Low);
            DomainDescriptor _lastDomainDescriptor = new DomainDescriptor()
            {
                NextStepRecordType = RecordType.DomainDescriptor
            };
            Uri _nextUri   = rootZoneUrl;
            int _iteration = 0;

            do
            {
                _iteration++;
                log($"Resolving address iteration {_iteration} address: {_nextUri}", TraceEventType.Verbose, Priority.Low);
                if (_iteration > 16)
                {
                    throw new InvalidOperationException("Too many iteration in the resolving process.");
                }
                _lastDomainDescriptor = await GetHTTPResponseAsync <DomainDescriptor>(_nextUri, log);

                _nextUri = _lastDomainDescriptor.ResolveUri(modelUri);
            } while (_lastDomainDescriptor.NextStepRecordType == RecordType.DomainDescriptor);
            log($"Reading DomainModel at: {_nextUri}", TraceEventType.Verbose, Priority.Low);
            Task <DomainModel> _DomainModelTask = GetHTTPResponseAsync <DomainModel>(_nextUri, log);
            DomainModel        _model           = await _DomainModelTask;

            _model.UniversalDiscoveryServiceLocator = _nextUri.ToString();
            log($"Successfuly received and decoded the requested DomainModel record: {_nextUri}", TraceEventType.Verbose, Priority.Low);
            return(_model);
        }
Ejemplo n.º 22
0
 public ModuleRequirements()
 {
     Domain         = new DomainModel();
     UIDefinitions  = new UIDefinition[0];
     RequredModules = new int[0];
     Templates      = new HtmlTemplate[0];
 }
Ejemplo n.º 23
0
 public virtual void CaseArchitecture(DomainModel.Ast.Architecture x)
 {
     x.Prolog.Visit(this);
     x.Imports.ForEach(s => SymbolTable.Imports.Add(s));
     x.Artefacts.ForEach(ar => ar.Visit(this));
     x.Definitions.ForEach(d => d.Visit(this));
 }
Ejemplo n.º 24
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Adds a property.
        /// </summary>
        /// <exception cref="Exception">
        ///  Thrown when an exception error condition occurs.
        /// </exception>
        /// <param name="property">
        ///  The property definition.
        /// </param>
        /// <returns>
        ///  An ISchemaProperty.
        /// </returns>
        /// <exception cref="System.Exception">
        ///  Duplicate property name.
        /// </exception>
        ///-------------------------------------------------------------------------------------------------
        protected ISchemaProperty DefineProperty(ISchemaProperty property)
        {
            Contract.Requires(property, "property");

            lock (_propertiesByName)
            {
                if (GetProperty(property.Name) != null)
                {
                    throw new Hyperstore.Modeling.MemoryStore.DuplicateElementException(ExceptionMessages.DuplicatePropertyName);
                }

                _properties.Add(property);
                _propertiesByName.TryAdd(property.Name, property);
            }

            var trace = DomainModel.Resolve <IHyperstoreTrace>(false);

            if (trace != null)
            {
                trace.WriteTrace(TraceCategory.Metadata, ExceptionMessages.CreatePropertyWithIdForMetaclassFormat, property.Name, property.Id, ((IModelElement)this).Id);
            }

            var constraint = property.PropertySchema as Hyperstore.Modeling.Metadata.Constraints.IConstraint;

            if (constraint != null && this.Schema.Constraints is IConstraintManagerInternal)
            {
                (this.Schema.Constraints as IConstraintManagerInternal).AddConstraint(property, constraint);
            }
            return(property);
        }
Ejemplo n.º 25
0
        public ActionResult Carrello()
        {
            DomainModel dm = new DomainModel();

            ViewBag.prodotti = Session["products"] as List <Prodotto>;
            return(View());
        }
Ejemplo n.º 26
0
        public ResponseModel Search(string item)
        {
            DomainModel db = new DomainModel();
            List<Basic_Information> students = (from u in db.Basic_Information
                                                where u.Name.Contains(item)
                                                select u).ToList();
            //  List<Basic_Information> students = db.Basic_Information.Include(x => x.Class).Include(x => x.Department).Where(x => x.Phone == item).ToList();
            if (true)
            {
                ResponseModel response = new ResponseModel()
                {

                    Issucces = true,
                    Message = "Data",
                    Data = new List<Basic_Information>(students)

                };

            }

            ResponseModel response1 = new ResponseModel()
            {

                Issucces = true,
                Message = "Data Not found",
                Data = new List<Basic_Information>(students)

            };
            return response1;
        }
Ejemplo n.º 27
0
        public static Person AssemblePerson(DomainModel.Person person)
        {
            Person dto = new Person();
            dto.Id = (int)person.Id[0];
            dto.Name = person.Name;
            dto.Password = person.Password;
            dto.Timestamp = person.Timestamp.Value;

            ICollection addresses = person.Addresses;
            if(addresses != null && addresses.Count > 0)
            {
                int addrCount = addresses.Count;
                dto.Addresses = new Address[addrCount];
                IEnumerator addrEnum = addresses.GetEnumerator();
                for(int i = 0; i < addrCount; i++)
                {
                    addrEnum.MoveNext();
                    dto.Addresses[i] = AssembleAddress((DomainModel.Address)addrEnum.Current);
                }
            }

            //            ICollection roles = person.Roles;
            //            if(roles != null && roles.Count > 0)
            //            {
            //                dto.Roles = new Role[roles.Count];
            //                IEnumerator roleEnum = roles.GetEnumerator();
            //                for(int i = 0; i < roles.Count; i++)
            //                {
            //                    roleEnum.MoveNext();
            //                    dto.Roles[i] = AssembleRole((DomainModel.Person.PersonRole)roleEnum.Current);
            //                }
            //            }

            return dto;
        }
Ejemplo n.º 28
0
        private void MapAddUpdate(DomainModel Domain, AddUpdateBase AddUpdate)
        {
            MapBase(Domain, AddUpdate as IcimsModelBase);

            //Doctor
            if (Domain.Doctor != null)
            {
                AddUpdate.gp_surname = Domain.Doctor.Family;
                AddUpdate.gp_fname   = Domain.Doctor.Given;

                if (Domain.Doctor.Contact != null)
                {
                    if (Domain.Doctor.Contact.EmailList.Count > 0)
                    {
                        AddUpdate.gp_email = Domain.Doctor.Contact.EmailList[0];
                    }
                    if (Domain.Doctor.Contact.FaxList.Count > 0)
                    {
                        AddUpdate.gp_fax = Domain.Doctor.Contact.FaxList[0];
                    }
                }

                if (Domain.Doctor.Address != null)
                {
                    AddUpdate.gp_addr_line_1 = Domain.Doctor.Address.AddressLineOne;
                    AddUpdate.gp_addr_line_2 = Domain.Doctor.Address.AddressLineTwo;
                    AddUpdate.gp_suburb      = Domain.Doctor.Address.Suburb;
                    AddUpdate.gp_postcode    = Domain.Doctor.Address.PostCode;
                    AddUpdate.gp_state       = Domain.Doctor.Address.State;
                }
            }
        }
Ejemplo n.º 29
0
        private static void VisitDependencies(Guid modelId, Dictionary <Guid, int> headNodes, Dictionary <Guid, List <Guid> > directDependencies, DomainModel[] allModels, DomainModel[] results, ref int nextResultIndex)
        {
            int modelIndex = headNodes[modelId];

            if (modelIndex < 0)
            {
                modelIndex = ~modelIndex;
            }
            DomainModel model = allModels[modelIndex];

            if (model == null)
            {
                // Already processed
                return;
            }
            allModels[modelIndex] = null;

            List <Guid> dependencies;

            if (directDependencies.TryGetValue(modelId, out dependencies))
            {
                for (int i = 0, count = dependencies.Count; i < count; ++i)
                {
                    VisitDependencies(dependencies[i], headNodes, directDependencies, allModels, results, ref nextResultIndex);
                }
            }
            results[nextResultIndex] = model;
            ++nextResultIndex;
        }
Ejemplo n.º 30
0
        public Update MapToUpdate(DomainModel Domain)
        {
            var Update = new Update();

            MapAddUpdate(Domain, Update as AddUpdateBase);
            return(Update);
        }
Ejemplo n.º 31
0
        public void SimpleTryBlockWithinOneMethodWithTwoCatchHandlers()
        {
            //Arrange
            ITest test = new CorrectOrderCheck();

            MethodDesc mainMethod = new MethodDesc("Main", 3)
                                    .EntryPoint()
                                    .AddInheritanceAttributeFlag(MethodInheritanceAttributes.Global)
                                    .AddInstructions(new ILInstruction[]
            {
                new ILInstruction(ByteCode.Nop, "1. Just before try start").Data(1),
                //----------try begin-------------
                new ILInstruction(ByteCode.Nop, "2. At the try first instruction start").AddLabel("TryBeg").Data(2),
                new ILInstruction(ByteCode.Nop, "3. Just before throw").Data(3),
                new ILInstruction(ByteCode.Newobj, TempTypeLocator.InvalidOperationExceptionDesc.Methods[0].Metadata /*ctor*/),
                new ILInstruction(ByteCode.Throw),
                new ILInstruction(ByteCode.Nop, "Just after throw"),
                new ILInstruction(ByteCode.Nop, "Just before try leave instruction"),
                new ILInstruction(ByteCode.Leave, new Label("TryLeaveDest")).AddLabel("TryEnd"),
                //----------try end-------------
                new ILInstruction(ByteCode.Nop, "Between try and catch"),
                //----------catch1 begin-------------
                new ILInstruction(ByteCode.Nop, "4. At the catch1 start").AddLabel("Catch1Beg").Data(4),
                new ILInstruction(ByteCode.Pop),
                new ILInstruction(ByteCode.Nop, "5. Just before catch1 leave instruction").Data(5),
                new ILInstruction(ByteCode.Leave, new Label("CatchLeaveDest")).AddLabel("Catch1End"),
                //----------catch1 end-------------

                //----------catch2 begin-------------
                new ILInstruction(ByteCode.Pop).AddLabel("Catch2Beg"),
                new ILInstruction(ByteCode.Nop, "At the catch2 start"),
                new ILInstruction(ByteCode.Nop, "Just before catch2 leave instruction"),
                new ILInstruction(ByteCode.Leave, new Label("CatchLeaveDest")).AddLabel("Catch2End"),
                //----------catch2 end-------------
                new ILInstruction(ByteCode.Nop, "Instruction where try leave points").AddLabel("TryLeaveDest"),
                new ILInstruction(ByteCode.Nop, "6(end). Instruction where catch leave points").AddLabel("CatchLeaveDest").Data(6),
                new ILInstruction(ByteCode.Ret)
            });

            mainMethod.EHTable.AddCatchHandler("TryBeg", "TryEnd", new ClassToken("System.InvalidOperationException", false), "Catch1Beg", "Catch1End");
            mainMethod.EHTable.AddCatchHandler("TryBeg", "TryEnd", new ClassToken("System.Exception", false), "Catch2Beg", "Catch2End");


            CompiledModel compiledModel = new CompiledModel()
                                          .AddMethod(mainMethod);

            DomainModel domainModel = new DomainModel(new GCHeap.Factory(), new TypesHeap.Factory());

            domainModel.LoadType(TempTypeLocator.ObjectDesc);
            domainModel.LoadType(TempTypeLocator.ExceptionDesc);
            domainModel.LoadType(TempTypeLocator.InvalidOperationExceptionDesc);

            var executor = domainModel.GetExecutor(compiledModel, new ILOperationSet());

            //Act
            executor.Start();

            //Assert
            Assert.IsTrue(test.Success());
        }
        // Constructors

        public DomainModelConverter(
            HandlerAccessor handlers,
            ITypeIdProvider typeIdProvider,
            PartialIndexFilterCompiler compiler,
            MappingResolver resolver,
            IFullTextCatalogNameBuilder fulltextCatalogNameBuilder,
            bool isUpgradingStage)
        {
            ArgumentValidator.EnsureArgumentNotNull(handlers, "handlers");
            ArgumentValidator.EnsureArgumentNotNull(typeIdProvider, "typeIdProvider");
            ArgumentValidator.EnsureArgumentNotNull(compiler, "compiler");
            ArgumentValidator.EnsureArgumentNotNull(resolver, "resolver");

            this.handlers                   = handlers;
            this.compiler                   = compiler;
            this.typeIdProvider             = typeIdProvider;
            this.resolver                   = resolver;
            this.isUpgradingStage           = isUpgradingStage;
            this.fulltextCatalogNameBuilder = fulltextCatalogNameBuilder;

            sourceModel       = handlers.Domain.Model;
            configuration     = handlers.Domain.Configuration;
            providerInfo      = handlers.ProviderInfo;
            driver            = handlers.StorageDriver;
            nameBuilder       = handlers.NameBuilder;
            FieldMapping      = new Dictionary <StoredFieldInfo, StoredFieldInfo>();
            StorageModel      = null;
            CurrentModelTypes = new Dictionary <string, StoredTypeInfo>();
        }
Ejemplo n.º 33
0
        public ActionResult VisualizzaCommessa(string commessa)
        {
            DomainModel model = new DomainModel();

            if (commessa.Length == 0)
            {
                ViewBag.Message = "Inserire un nome di commessa";
            }
            else
            {
                try{
                    DTCommessa dTCommessa = model.CercaCommessa(commessa);
                    if (dTCommessa != null)
                    {
                        List <DTGiorno> giorni = model.GiorniCommessa(dTCommessa.Id, P.Matricola);
                        if (giorni != null && giorni.Count > 0)
                        {
                            ViewBag.NomeCommessa = dTCommessa.Nome;
                            ViewBag.Giorni       = giorni;
                        }
                        else
                        {
                            ViewBag.Message = "Non hai mai lavorato su questa commessa!";
                        }
                    }
                }catch (Exception e) {
                    ViewBag.Message = "Errore del server";
                }
            }
            return(View("VisualizzaCommessa"));
        }
Ejemplo n.º 34
0
        public async Task <IActionResult> PutDomainModel([FromRoute] int id, [FromBody] DomainModel domainModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != domainModel.DomainId)
            {
                return(BadRequest());
            }

            context.Entry(domainModel).State = EntityState.Modified;

            try
            {
                await context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DomainModelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 35
0
        public async Task <IHttpActionResult> DeleteDomainModel([FromUri] string id)
        {
            try
            {
                DomainModel DomainModel = await VhostService.FindByIdAsync(ThreadStaticObject.UserId, id);

                if (DomainModel == null)
                {
                    return(NotFound());
                }

                ServiceResultMessage result = await VhostService.RemoveAsync(ThreadStaticObject.UserId, id);

                return(Json(new DjLiveResponse <dynamic>(DomainModel)));
            }
            catch (Exception e)
            {
                var errorId = Guid.NewGuid().Str();
                LogHelper.Error(errorId, e);
                return(Json(new DjLiveResponse <dynamic>()
                {
                    ApiCode = ApiCode.UnExceptError, Message = $@"发生未知错误,请联系管理员,错误代码:{errorId}"
                }));
            }
        }
Ejemplo n.º 36
0
        public ActionResult Single(int id)
        {
            DomainModel dm = new DomainModel();

            ViewBag.Products = dm.CercaId(id);
            return(View());
        }
Ejemplo n.º 37
0
        protected override void Act()
        {
            var domainModelDefinitions = new DomainModelDefinitions(
                new SchemaDefinition("schema", "schema"),
                new[]
            {
                new AggregateDefinition(
                    new FullName("schema", "Aggregate"),
                    new[]
                {
                    new FullName("schema", "AChild")
                })
            },
                new[]
            {
                new EntityDefinition("schema", "Aggregate", new EntityPropertyDefinition[0], new EntityIdentifierDefinition[0]),
                new EntityDefinition("schema", "AChild", new EntityPropertyDefinition[0], new EntityIdentifierDefinition[0])
            },
                new AssociationDefinition[0],
                new AggregateExtensionDefinition[0]);

            var builder = new DomainModelBuilder(
                new[]
            {
                domainModelDefinitions
            });

            _domainModel = builder.Build();
        }
Ejemplo n.º 38
0
 public bool Get(string userName)
 {
     DomainModel db = new DomainModel();
     List<Department> deptsList = (from u in db.Departments
                                         where u.Department_Name.Contains(userName)
                                         select u).ToList();
     return deptsList.Count == 0;
 }
Ejemplo n.º 39
0
 public static OrderDetail AssembleOrderDetail(DomainModel.OrderDetail detail)
 {
     OrderDetail dto = new OrderDetail();
     dto.ProductId = (int)detail.Product.Id[0];
     dto.Quantity = detail.Quantity;
     dto.UnitPrice = detail.UnitPrice;
     dto.Timestamp = detail.Timestamp.Value;
     return dto;
 }
Ejemplo n.º 40
0
 public UserJoinedChatEvent(
     User user,
     Chat chat,
     DomainModel sender)
     : base(user,
     sender)
 {
     Chat = chat;
 }
Ejemplo n.º 41
0
 public HandlingActivity(HandlingEventType eventType, DomainModel.Potential.Location.Location location)
 {
    if (location == null)
    {
       throw new ArgumentNullException("location");
    }
    _eventType = eventType;
    _location = location;
 }
 public RequestPasswordUpdate(
     User user,
     DomainModel sender,
     bool sendEmail)
     : base(user,
     sender)
 {
     SendEmail = sendEmail;
 }
Ejemplo n.º 43
0
 public virtual void CaseApplication(DomainModel.Ast.Application x)
 {
     x.Name.Visit(this);
     x.Bases.ForEach(y => y.Visit(this));
     x.Applications.ForEach(y => y.Visit(this));
     x.Dependencies.ForEach(y => y.Visit(this));
     x.PropertyDefinitions.ForEach(y => y.Visit(this));
     x.PropertyDeclarations.ForEach(y => y.Visit(this));
 }
 public OnlineUserUpdatedEvent(
     User user,
     OnlineUser onlineUser,
     string connectionId,
     DomainModel sender)
     : base(user,
     sender)
 {
     OnlineUser = onlineUser;
     ConnectionId = connectionId;
 }
 public MediaResourceCreateFailedEvent(
     User user,
     string key,
     string reason,
     DomainModel sender)
     : base(user,
     sender)
 {
     Key = key;
     Reason = reason;
 }
Ejemplo n.º 46
0
 public static Address AssembleAddress(DomainModel.Address address)
 {
     Address dto = new Address();
     dto.Id = (int)(address.Id[0]);
     dto.Street = address.Street;
     dto.City = address.City;
     dto.Email = address.Email;
     dto.Postalcode = address.PostalCode;
     dto.Phone = address.Phone;
     dto.Timestamp = address.Timestamp.Value;
     return dto;
 }
Ejemplo n.º 47
0
        public async Task<IEnumerable<ColumnLevelMetadata>> GetColumnMetadataFromFile(DomainModel.File fileDetail)
        {
            //throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Cannot get sheet details for file {0}", fileDetail.Name));
            Check.IsNotNull<DomainModel.File>(fileDetail, "fileDetail");
            List<ColumnLevelMetadata> columnLevelMetadataList = new List<ColumnLevelMetadata>();

            await Task.Factory.StartNew(() =>
            {
                columnLevelMetadataList = new List<ColumnLevelMetadata>();
            });

            return columnLevelMetadataList;
        }
		private ServiceContract CreateServiceContractModel()
		{
			scStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel));
			scDomainModel = scStore.GetDomainModel<ServiceContractDslDomainModel>();
			scTransaction = scStore.TransactionManager.BeginTransaction();

			scModel = (ServiceContractModel)scDomainModel.CreateElement(new Partition(scStore), typeof(ServiceContractModel), null);
			scModel.ImplementationTechnology = new ServiceContractWCFExtensionProvider();
			scModel.ProjectMappingTable = projectMappingTableName;

			ServiceContract sc = scStore.ElementFactory.CreateElement(ServiceContract.DomainClassId) as ServiceContract;
			sc.Name = serviceContractName;

			scModel.ServiceContracts.Add(sc);
			return sc;
		}
Ejemplo n.º 49
0
        public async Task<IEnumerable<Utilities.Model.FileSheet>> GetDocumentSheetDetails(DomainModel.File fileDetail)
        {
            //throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Cannot get sheet details for file {0}", fileDetail.Name));
            Check.IsNotNull<DomainModel.File>(fileDetail, "fileDetail");
            List<FileSheet> fileSheets = new List<FileSheet>();
            await Task.Factory.StartNew(() =>
            {
                string fileName = Path.GetFileNameWithoutExtension(fileDetail.Name);
                fileSheets.Add(new FileSheet()
                {
                    SheetName = fileName,
                    SheetId = fileName
                });
            });

            return fileSheets;
        }
Ejemplo n.º 50
0
 //        public static Role AssembleRole(DomainModel.Person.PersonRole role)
 //        {
 //            return (Role)Enum.Parse(typeof(Role), role.ToString(), true);
 //        }
 public static Order AssembleOrder(DomainModel.Order order)
 {
     Order dto = new Order();
     dto.OrderDate = order.OrderDate;
     dto.ShippedDate = order.ShippedDate;
     dto.Timestamp = order.Timestamp.Value;
     ICollection orderDetails = order.OrderDetails;
     dto.OrderDetails = new OrderDetail[orderDetails.Count];
     IEnumerator detailEnum = orderDetails.GetEnumerator();
     for(int i = 0; i < orderDetails.Count; i++)
     {
         detailEnum.MoveNext();
         dto.OrderDetails[i] =
             AssembleOrderDetail((DomainModel.OrderDetail)detailEnum.Current);
     }
     return dto;
 }
        public void TestInitialize()
        {
            serviceProvider = new MockMappingServiceProvider();

			attributes = new NameValueCollection();
			attributes.Add("elementNameProperty", "Name");

            #region Data Contract
            dcStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(DataContractDslDomainModel));
            dcDomainModel = dcStore.GetDomainModel<DataContractDslDomainModel>();
            dcTransaction = dcStore.TransactionManager.BeginTransaction();
            dcModel = (DataContractModel)dcDomainModel.CreateElement(new Partition(dcStore), typeof(DataContractModel), null);
            dcModel.ProjectMappingTable = projectMappingTableName;
            dc = dcStore.ElementFactory.CreateElement(DataContract.DomainClassId) as DataContract;
			primitiveDataElement = dcStore.ElementFactory.CreateElement(PrimitiveDataType.DomainClassId) as PrimitiveDataType;
            primitiveDataElement.Name = primitiveDataElementName;
			dc.DataMembers.Add(primitiveDataElement);
			dcModel.Contracts.Add(dc);
            #endregion

			#region Service Contract
			scStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel));
			scDomainModel = scStore.GetDomainModel<ServiceContractDslDomainModel>();
			scTransaction = scStore.TransactionManager.BeginTransaction();
			scModel = (ServiceContractModel)scDomainModel.CreateElement(new Partition(scStore), typeof(ServiceContractModel), null);
			scModel.ProjectMappingTable = projectMappingTableName;
			msg = scStore.ElementFactory.CreateElement(Message.DomainClassId) as Message;
			msg.Name = messageName;

            //Create the moniker
            //mel://[DSLNAMESPACE]\[MODELELEMENTTYPE]\[MODELELEMENT.GUID]@[PROJECT]\[MODELFILE]
            string requestMoniker = string.Format(@"mel://{0}\{1}\{2}@{3}\{4}",
                primitiveDataElement.GetType().Namespace,
                primitiveDataElement.GetType().Name,
                primitiveDataElement.Id.ToString(),
                dataContractModelProjectName, dataContractModelFileName);

			part = scStore.ElementFactory.CreateElement(DataContractMessagePart.DomainClassId) as DataContractMessagePart;
			part.Name = partName;
            part.Type = new MockModelBusReference(primitiveDataElement);
			
            msg.MessageParts.Add(part);
			scModel.Messages.Add(msg);
            #endregion
        }
Ejemplo n.º 52
0
        public async Task<IEnumerable<ColumnLevelMetadata>> GetColumnMetadataFromFile(DomainModel.File fileDetail)
        {
            Check.IsNotNull<DomainModel.File>(fileDetail, "fileDetail");
            IEnumerable<ColumnLevelMetadata> columnLevelMetadataList = new List<ColumnLevelMetadata>();

            await Task.Factory.StartNew(() =>
            {
                var fileArray = base.GetFileContentsAsByteArray(fileDetail.BlobId);
                SpreadsheetDocument excelDocument;
                using (var documentStream = new MemoryStream(fileArray))
                {
                    excelDocument = SpreadsheetDocument.Open(documentStream, false);
                    columnLevelMetadataList = ExcelFileHelper.GetColumnMetadataForAllSheets(excelDocument);
                }
            });

            return columnLevelMetadataList;
        }
Ejemplo n.º 53
0
        public ResponseModel Get()
        {
            //DomainModel db = new DomainModel();
            List<Basic_Information> students;
            using (var db = new DomainModel())
            {
                students = db.Basic_Information.ToList();
                //students = db.Basic_Information.ToList();
            }
            ResponseModel response = new ResponseModel()
            {
                Issucces = true,
                Message = "Data",
                Data = students
            };

            return response;
        }
Ejemplo n.º 54
0
        public async Task<IEnumerable<ColumnLevelMetadata>> GetColumnMetadataFromFile(DomainModel.File fileDetail)
        {
            Check.IsNotNull<DomainModel.File>(fileDetail, "fileDetail");
            IEnumerable<ColumnLevelMetadata> columnLevelMetadataList = new List<ColumnLevelMetadata>();

            await Task.Factory.StartNew(() =>
            {
                using (Stream dataStream = base.BlobDataRepository.GetBlob(fileDetail.BlobId))
                {
                    using (StreamReader reader = new StreamReader(new MemoryStream()))
                    {
                        // copy stream to input stream on the reader to parse content
                        dataStream.Seek(0, SeekOrigin.Begin);
                        dataStream.CopyToStream(reader.BaseStream);

                        // seek the begening of content
                        reader.BaseStream.Seek(0, SeekOrigin.Begin);
                        string fileName = Path.GetFileNameWithoutExtension(fileDetail.Name);

                        List<string> headers = new List<string>();
                        List<string> dataElements = new List<string>();

                        // iterate over each record in the data file
                        if (reader.Peek() >= 0)
                        {
                            // read the current line
                            string dataRow = reader.ReadLine();
                            headers = dataRow.Split(',').Select(e => e.Trim()).ToList();

                            ////if (reader.Peek() >= 0)
                            ////{
                            ////    dataRow = reader.ReadLine();
                            ////    dataElements = dataRow.Split(',').Select(e => e.Trim()).ToList();
                            ////}
                        }

                        columnLevelMetadataList = CreateColumnLevelMetadataList(fileName, headers);
                    }
                }
            });


            return columnLevelMetadataList;
        }
Ejemplo n.º 55
0
        public override void CaseApplication(DomainModel.Ast.Application x)
        {
            Contract.Requires(x != null);
            Contract.Ensures(Contract.OldValue(ApplicationScope.Count) == ApplicationScope.Count);
            Contract.Requires(SymbolTable != null);
            Contract.RequiresAlways(!String.IsNullOrEmpty(x.ProperName));
            Contract.Ensures(SymbolTable.Applications.Count >= Contract.OldValue(SymbolTable.Applications.Count));

            if (x == null)
                throw new ArgumentNullException("x");
            if (string.IsNullOrEmpty(x.ProperName))
                throw new ArgumentException("x.ProperName");

            if (SymbolTable.Applications.ContainsKey(x.ProperName))
            {
                SymbolTable.AddError("(unknown location) Duplicate application definition for {0}", x.ProperName);
            }

            if (BasesIncludesSelf(x))
            {
                SymbolTable.AddError("{0} cannot derive from itself", x.ProperName);
            }

            if (ArtefactDerivesFromAnEnclosingScopeArtefact(x, () => ApplicationScope.Cast<ArtefactBase>()))
            {
                SymbolTable.AddError("{0} cannot derive from an enclosing scope application", x.ProperName);
            }

            ApplicationScope.Push(x);

            foreach (var subArtefact in x.Applications)
            {
                subArtefact.Visit(this);
            }

            bool allDependenciesAreKnown = x.Dependencies.All(i => IsKnownReference(i, () => SymbolTable.Applications.Values.Cast<ArtefactBase>()));
            if (!allDependenciesAreKnown)
            {
                SymbolTable.AddError("Application {0} declares a dependency that has not been defined previously", x.ProperName);
            }

            ApplicationScope.Pop();
            SymbolTable.RaiseNewApplicationEvent(x);
        }
        public void TestInitialize()
        {
            serviceProvider = new MockMappingServiceProvider();

			scStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel));			
			scDomainModel = scStore.GetDomainModel<ServiceContractDslDomainModel>();
			scTransaction = scStore.TransactionManager.BeginTransaction();

			scModel = (ServiceContractModel)scDomainModel.CreateElement(new Partition(scStore), typeof(ServiceContractModel), null);
			scModel.ImplementationTechnology = new ServiceContractWCFExtensionProvider();
			scModel.ProjectMappingTable = projectMappingTableName;

			ServiceContract sc = scStore.ElementFactory.CreateElement(ServiceContract.DomainClassId) as ServiceContract;
			sc.Name = serviceContractName;

			scModel.ServiceContracts.Add(sc);

			hdStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel));
			hdDomainModel = hdStore.GetDomainModel<HostDesignerDomainModel>();
            hdTransaction = hdStore.TransactionManager.BeginTransaction();
			hdModel = (HostDesignerModel)hdDomainModel.CreateElement(new Partition(hdStore), typeof(HostDesignerModel), null);

			HostApplication app = (HostApplication)hdStore.ElementFactory.CreateElement(HostApplication.DomainClassId);

			app.ImplementationTechnology = new HostDesignerWcfExtensionProvider();

			reference = (ServiceReference)hdStore.ElementFactory.CreateElement(ServiceReference.DomainClassId);

			//mel://[DSLNAMESPACE]\[MODELELEMENTTYPE]\[MODELELEMENT.GUID]@[PROJECT]\[MODELFILE]
			string serviceMoniker = string.Format(@"mel://{0}\{1}\{2}@{3}\{4}",
				sc.GetType().Namespace,
				serviceContractName,
				sc.Id.ToString(),
				serviceContractModelProjectName, serviceContractModelFileName);

			reference.Name = serviceMelReferenceName;
            reference.ServiceImplementationType = new MockModelBusReference(sc);

			app.ServiceDescriptions.Add(reference);

			// Initialize validator's config
            attributes = new NameValueCollection();
            attributes.Add("elementNameProperty", "Name");
        }
Ejemplo n.º 57
0
      public RouteSpecification(DomainModel.Potential.Location.Location origin, DomainModel.Potential.Location.Location destination, DateTime arrivalDeadline)
      {
         if (origin == null)
         {
            throw new ArgumentNullException("origin");
         }
         if (destination == null)
         {
            throw new ArgumentNullException("destination");
         }
         if (origin == destination)
         {
            throw new ArgumentException("Origin and destination can't be the same.");
         }

         _origin = origin;
         _arrivalDeadline = arrivalDeadline;
         _destination = destination;
      }
        public void TestInitialize()
        {
            serviceProvider = new MockMappingServiceProvider();

			attributes = new NameValueCollection();
			attributes.Add("elementNameProperty", "Name");

            #region Data Contract
            dcStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(DataContractDslDomainModel));
            dcDomainModel = dcStore.GetDomainModel<DataContractDslDomainModel>();
            dcTransaction = dcStore.TransactionManager.BeginTransaction();
            dcModel = (DataContractModel)dcDomainModel.CreateElement(new Partition(dcStore), typeof(DataContractModel), null);
            dcModel.ProjectMappingTable = projectMappingTableName;
            fc = dcStore.ElementFactory.CreateElement(FaultContract.DomainClassId) as FaultContract;
            fc.Name = faultContractName;
			dcModel.Contracts.Add(fc);
            #endregion

			#region Service Contract
			scStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel));
			scDomainModel = scStore.GetDomainModel<ServiceContractDslDomainModel>();
			scTransaction = scStore.TransactionManager.BeginTransaction();
			scModel = (ServiceContractModel)scDomainModel.CreateElement(new Partition(scStore), typeof(ServiceContractModel), null);
			scModel.ProjectMappingTable = projectMappingTableName;
            operation = scStore.ElementFactory.CreateElement(Operation.DomainClassId) as Operation;
            operation.Name = operationName;

            //Create the moniker
            //mel://[DSLNAMESPACE]\[MODELELEMENTTYPE]\[MODELELEMENT.GUID]@[PROJECT]\[MODELFILE]
            string requestMoniker = string.Format(@"mel://{0}\{1}\{2}@{3}\{4}",
                fc.GetType().Namespace,
                fc.GetType().Name,
                fc.Id.ToString(),
                dataContractModelProjectName, dataContractModelFileName);

            dcfault = scStore.ElementFactory.CreateElement(DataContractFault.DomainClassId) as DataContractFault;
			dcfault.Name = dcfaultName;
            dcfault.Type = new MockModelBusReference(fc);
            
            operation.Faults.Add(dcfault);
			scModel.Operations.Add(operation);
            #endregion
        }
        public void DeleteExam(DomainModel.Exam exam)
        {
            Contract.Requires<ArgumentNullException>(exam != null, "The exam must be non-null!");

            using (var context = new SchoolContext())
            {
                context.Exams.Attach(exam);
                context.Exams.Remove(exam);

                if (context.SaveChanges() != 0)
                {
                    /*
                    Logger.Write("The exam " + exam + " was successfully removed!", "General", 2, 2, TraceEventType.Information);
                     * */
                }/*
                else
                {
                    Logger.Write("The exam " + exam + " was not removed!", "Important", 1, 1, TraceEventType.Error);
                }*/
            }
        }
 public void AddExam(DomainModel.Exam exam)
 {
     using (var context = new SchoolContext())
     {
         context.Exams.Add(exam);
         if (context.SaveChanges() != 0)
         {
             /*
             if (Logger.IsLoggingEnabled())
             {
                 Logger.Write("The exam: " + exam + " has been successfully added!", "General", 2, 2, TraceEventType.Information);
             }*/
         } /*
         else
         {
             if (Logger.IsLoggingEnabled())
             {
                 Logger.Write("The exam: " + exam + " insertion has failed!", "Important", 1, 1, TraceEventType.Error);
             }
         }*/
     }
 }