,net Developer
,net Developer
Factory pattern is one of the most used design patterns in Java. This type of design
pattern comes under creational pattern as this pattern provides one of the best ways to
create an object.
In Factory pattern, we create object without exposing the creation logic to the client and
refer to newly created object using a common interface.
https://www.tutorialspoint.com/design_pattern/factory_pattern.htm
Abstract Factory patterns work around a super-factory which creates other factories.
This factory is also called as factory of factories. This type of design pattern comes under
creational pattern as this pattern provides one of the best ways to create an object.
In Abstract Factory pattern an interface is responsible for creating a factory of related
objects without explicitly specifying their classes. Each generated factory can give the
objects as per the Factory pattern.
https://www.tutorialspoint.com/design_pattern/abstract_factory_pattern.htm
Prototype pattern refers to creating duplicate object while keeping performance in mind.
This type of design pattern comes under creational pattern as this pattern provides one of
the best ways to create an object.
This pattern involves implementing a prototype interface which tells to create a clone of
the current object. This pattern is used when creation of object directly is costly. For
example, an object is to be created after a costly database operation. We can cache the
object, returns its clone on next request and update the database as and when needed
thus reducing database calls.
https://www.tutorialspoint.com/design_pattern/prototype_pattern.htm
C#
https://www.tutorialspoint.com/csharp
System.Collections.
https://www.tutorialspoint.com/csharp/csharp_collections.htm
ArrayList List It represents ordered collection of an object that can be indexed individually.
It is basically an alternative to an array. However, unlike array you can add and remove
items from a list at a specified position using an index and the array resizes itself
automatically. It also allows dynamic memory allocation, adding, searching and sorting
items in the list.
A namespace is designed for providing a way to keep one set of names separate from
another. The class names declared in one namespace does not conflict with the same
class names declared in another.
Dependency Injection
Dependency injection is a patron whereby /werbai/ one object supplies the dependencies
of another object. you need to use an Interface to define the signature of props, methods
that you will implement in the different classes.
In the class where instance the interface, needs create a private props:
Private readonly IRepository _repository
public myService(IRepository repository) {
_ repository = repository
}
With the .NET Framework, we used to use containers like LightInject, NInject, Unity etc.
But in .NET Core, Microsoft has provided an in-built container. We need to add the
namespace, i.e., Microsoft.Extension.DependencyInjection.
So, in the startup class, inside the ConfigureServices method, we need to add our
dependency into the service collection which will dynamically inject whenever and
wherever we want in the project. Also, we can mention which kind of instance we want to
inject - the lifetime of our instance.
Transient /*Traein-cient*/
It creates an instance each time they are requested and are never shared. It is used
mainly for lightweight stateless services.
Singleton /*singlethon*/
This creates only single instances which are shared among all components that require it.
Scoped
It creates an instance once per scope which is created on every request to the application.
LynQ
LINQ (Language Integrated Query) is uniform query syntax in C# and VB.NET to retrieve
data from different sources and formats. LINQ queries return results as objects
Database First: app.config or web.config (config file) is the connection string. the CS
metadata are exposed so, in code first no.
Entity Data Model contains three parts Storage Model, Conceptual Model, Mapping
between the two.
Storage Model is the representation of the database objects, (Tables SPS),
DBContext DbContext is the primary class that is responsible for interacting with the
database. It is responsible for the following activities:
In DBFirst the DB context contains the method based on the SPS and Funcions to
connect to the database.
DB Set its the collections of objects that represent the tables in the database. map the
tables in the database
Complex Types when your Store Procedure joins tables together and its result can not
mapping with the EF entities. or when you have a large tabla and wants only 2 fields.
CodeFirst: the Code-First approach, you focus on the domain of your
application and start creating classes for your domain entity rather than
design your database first and then create the classes which match your
database design. The following figure illustrates the code-first approach
Migrations: enable-migrations, add-migration.
Add-migration InitialModel -IgnoreChanges -Force to create an empty migration
The strategies to Loading Related Object are
Lazy Loading
https://www.tutorialspoint.com/entity_framework/entity_framework_lazy_l
oading.htm
Lazy loading is the process whereby an entity or collection of entities is automatically
loaded from the database the first time that a property referring to the entity/entities is
accessed. Lazy loading means delaying the loading of related data, until you
specifically request for it.
Eager Loading
https://www.tutorialspoint.com/entity_framework/entity_framework_eager
_loading.htm
Eager loading is the process whereby a query for one type of entity also loads related
entities as part of the query. Eager loading is achieved by the use of the Include
method.
It means that requesting related data be returned along with query results from the
database. There is only one connection made to the data source, a larger amount of
data is returned in the initial query.
For example, when querying students, eager-load their enrollments. The students and
their enrollments will be retrieved in a single query.
Explicit Loading
https://www.tutorialspoint.com/entity_framework/entity_framework_explicit_loading
.htm
When you disabled the lazy loading, it is still possible to lazily load related entities, but it
must be done with an explicit call.
Unlike lazy loading, there is no ambiguity or possibility of confusion regarding when a
query is run.
To do so you use the Load method on the related entity’s entry.
For a one-to-many relationship, call the Load method on Collection.
And for a one-to-one relationship, call the Load method on Reference.
MVC
https://www.tutorialspoint.com/asp.net_mvc/
ASP.NET MVC is an open-source software from Microsoft. Its web development
framework combines the features of MVC (Model-View-Controller) architecture, the
most up-to-date ideas and techniques from Agile development and the best parts of
the existing ASP.NET platform.
The application life cycle refers to the time at which the application process actually
begins running IIS until the time it stops. This is marked by the application start and
end events in the startup file of your application.
Life Cycle
in the global file there are two methods
1. Applications Start
2. Record Areas if i have defined
3. Record the paths
4. Record Modules
5. Execute the filters the I have been defined
6. the next one is the controller, the controller execute based on models and
renderize in the view.
7. application end
API https://www.tutorialspoint.com/restful/index.htm
RESTful Web Services are basically REST Architecture based Web Services. In REST
Architecture everything is a resource. RESTful web services are light weight, highly
scalable and maintainable and are very commonly used to create APIs for web-based
applications.
.NET Core
.Net Core
Pruebas Unitarias
Pruebas de integración
Class Libraries
Tasks: