• /r/csharp
  • Writing more efficient/better code?

    I am a junior in college, and well above my peers when it comes to programming. However, recently I started an internship. While my coding skills are capable of solving any task I’m handed. When I see some senior developers work. They’re code is incredibly efficient. I understand that experience plays a role. But, are […]

  • /r/csharp
  • How do you use delegate factories after you’ve created them?

    (Autofac) Every example I see has them resolving directly through the container. If I need an object created in a random class, I won’t have access to my container. var builder = new ContainerBuilder(); builder.RegisterType<Shareholding>(); var container = builder.Build(); var shareholdingFactory = container.Resolve<Shareholding.Factory>(); var shareholding = shareholdingFactory.Invoke(“ABC”, 1234); How do I do this without access […]

  • /r/csharp
  • EF is telling me to apply migrations that don’t exist to a database that hasn’t been created yet

    PM> Enable-Migrations -ContextTypeName bruh.Models.ApplicationDbContext Checking if the context targets an existing database… Code First Migrations enabled for project bruh. PM> add-migration Initial -ConfigurationTypeName Configuration Unable to generate an explicit migration because the following explicit migrations are pending: [201709151055080_Initial, 201709151123514_EmailsToTemplatesRelationship, 201709191219231_updatedEmailsModel, 201711090847215_EmailTemplateCampaignLink]. Apply the pending explicit migrations before attempting to generate a new explicit migration. I […]