Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

502
Vistas
What does the angle bracket syntax mean in C#

I am reading this book, and it tries to use initializer to Create the DB each time the application runs, so the code snippet is like this:

protected void Application_Start() {
    Database.SetInitializer(new DropCreateDatabaseAlways<MusicStoreDB>());

    AreaRegistration.RegisterAllAreas();
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
}

I can't understand this part:

 new DropCreateDatabaseAlways<MusicStoreDB>()

What is this syntax? what does <MusicStoreDB>() mean?

I know it's not a fancy question, but I need help here.

Thanks.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

That syntax is called generics. In a nutshell (a very tiny nutshell), imagine that your app had more than 1 database (e.g. MusicStoreDB, MovieStoreDB, etc), you could use the same DropCreateDatabaseAlways class with the different db types. In other words, generics let you define classes and functions that can act on many different types, for example

List<int>, List<string>, List<MyAwesomeClass>

over 4 years ago · Santiago Trujillo Denunciar

0

DropCreateDatabaseAlways is the database intializer base class. MusicStoreDB is the database which will be dropped and re-created everytime the application starts. DropCreateDatabaseAlways<MusicStoreDB>() is the code that does that

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda