Example #1
0
            public SimpleMembershipInitializer()
            {
                Database.SetInitializer <LinkManagerContext>(null);

                try
                {
                    using (var context = new LinkManagerContext())
                    {
                        if (!context.Database.Exists())
                        {
                            // Create the SimpleMembership database without Entity Framework migration schema
                            ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                        }
                    }

                    WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
                }
            }
Example #2
0
 public UnitOfWork(LinkManagerContext contextInitializer)
 {
     context = contextInitializer;
 }
 public TopicRepository(LinkManagerContext context)
     : base(context)
 {
 }
Example #4
0
 public UserRepository(LinkManagerContext context)
     : base(context)
 {
 }
Example #5
0
 public LinkService(LinkManagerContext context)
 {
     _context = context;
 }
Example #6
0
        public void UpdateLink(Link updatedLink)
        {
            var linkToBeUpdated = LinkManagerContext.Links.Find(updatedLink.LinkID);

            LinkManagerContext.Entry(linkToBeUpdated).CurrentValues.SetValues(updatedLink);
        }