private void InitArticleMemoryRepository() { IRepository<Article> memoryArticlesRepository = _memoryFactory .Begin() .UsingContainer<NoteworthyEFEntities>() .GetRepository(container => container.Articles); Topic ddd = new Topic() { TopicName = "ddd" }; Topic corresopndence = new Topic() { TopicName = "correspondence" }; Article efRepository = new Article() { Title = "Entity Framework and the Repository Pattern" }; efRepository.Topics.Add(ddd); Article correspondenceLaunch = new Article() { Title = "Correspondence Launch" }; correspondenceLaunch.Topics.Add(corresopndence); Article correspondenceDDD = new Article() { Title = "Correspondence and DDD" }; correspondenceDDD.Topics.Add(ddd); correspondenceDDD.Topics.Add(corresopndence); memoryArticlesRepository.Add(efRepository); memoryArticlesRepository.Add(correspondenceLaunch); memoryArticlesRepository.Add(correspondenceDDD); }
/// <summary> /// Create a new Topic object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="topicName">Initial value of the TopicName property.</param> public static Topic CreateTopic(global::System.Int32 id, global::System.String topicName) { Topic topic = new Topic(); topic.Id = id; topic.TopicName = topicName; return topic; }
/// <summary> /// Deprecated Method for adding a new object to the Topics EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTopics(Topic topic) { base.AddObject("Topics", topic); }