0% found this document useful (0 votes)
20 views

,net Developer

Uploaded by

Jhasney Seña
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

,net Developer

Uploaded by

Jhasney Seña
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Design Patterns

Design patterns represent the best practices used by experienced object-oriented


software developers. Design patterns are solutions to general problems that software
developers faced during software development. These solutions were obtained by trial
and error by numerous software developers over quite a substantial period of time.

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

var resultado = from letra in palabra orderby letra select letra;


Where: var filteredResult = studentList.Where(s => s.Age > 12 && s.Age < 20);
OfType (por tipo de datos): var stdResult = from s in mixedList.OfType<Student>()
select s;
OrderBy: var studentsInDescOrder = studentList.OrderByDescending(s =>
s.StudentName);
ThenBy: (ordena tambien por) var thenByResult = studentList.OrderBy(s =>
s.StudentName).ThenBy(s => s.Age);
Group By: var groupedResult = from s in studentList group s by s.Age;
foreach (var ageGroup in groupedResult){
Console.WriteLine("Age Group: {0}", ageGroup.Key); //Each group has a key
foreach(Student s in ageGroup) // Each group has inner collection
Console.WriteLine("Student Name: {0}", s.StudentName);
}

public bool isStringPalindrome(String input){

var reversed = new string(Enumerable.Range(1, input.Length).Select(i =>


input[input.Length - i]).ToArray()); return String.Compare(input,
reversed, true) == 0; }

public static bool esPalindrome(string palabra){

string alreves = new string(palabra.ToCharArray().Reverse().ToArray());

return (palabra == alreves ? true : false);

var arr = new[] { 3, 1, 2, 2, 4 }; var result = arr.GroupBy(n => n) //


Order by the frequency of each group of numbers .OrderBy(g => g.Count())
// Then by the natural order of each number .ThenBy(g => g.Key) //
Project the groups back to a flat array .SelectMany(g => g);
Console.WriteLine(string.Join(",", result)); // => 1,3,4,2,2
Entity Framework
Is an open source[3] object-relational mapping (ORM) framework for ADO.NET.
its principal workflows are:
 Database First: 1. We design our tables and EF Generates \yenereits\ domain
classes based on the database
 Code First: We Create our domain classes, and EF generates the database classes.
 Model First. We Create a UML diagram EF generates domain classes and database.
EDMX Designer: is a visual representation of the entity data model. EDMX is XML.

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 which derive /diraiv/ the database

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.

 Querying: Converts LINQ-to-Entities queries to SQL query and sends them to


the database.
 Change Tracking: Keeps track of changes that occurred on the entities after
querying from the database.
 Persisting Data: Performs the Insert, Update and Delete operations to the
database, based on entity states.
 Caching: Provides first level caching by default. It stores the entities which have
been retrieved during the life time of a context class.
 Manage Relationship: Manages relationships using CSDL, MSL and SSDL in Db-
First or Model-First approach, and using fluent API configurations in Code-First
approach.
 Object Materialization: Converts raw data from the database into entity objects.

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.

Action Filter. https://www.tutorialspoint.com/asp.net_mvc/asp.net_mvc_filters.htm

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.

Main Difference Between PUT and PATCH Requests


Also, another difference is that when you want to update a resource with PUT
request, you have to send the full payload as the request whereas with PATCH,
you only send the parameters which you want to update
Negociación de contenidos en ASP .NET WEB API

.NET Core

What do a middleware in .Net core?


Authorization types on .net core web API.

PWA progressive web apps, IONIC


Difference between SOAP and REST

.Net Core

Entity Framework Core

Test Driven development (TDD)

Pruebas Unitarias

Pruebas de integración

Class Libraries

Pipeline CI and CD:

a. Continuous Integration to build the application using pull-request or merge.


b. Unit Test and Integration Test.
c. Continuous delivery

Tasks:

1. Create an c# algorithm that return if a word is palindrome using lynq.


2. Algorithms using lynq
3. Create an API REST FULL using .Net Core, Dependency Injection (singleton).
4. Crud con MVC (View Model, Relación de uno a muchos y de muchos a muchos),
EF (LynQ), Code First, Dependency Injection, Unit Test Project.
https://medium.com/aeturnuminc/repository-pattern-with-dependency-
injection-mvc-ef-code-first-91344413ba1c
https://gist.github.com/LakshithaFernando
Senior .NET Interviews in google.

static void Main(String[] args)


{
int[] array = new int[10]{2,10,2,8,8,20,30,10,1,1};
Dictionary<int, int> _FrequenceCount = new Dictionary<int, int>();
var Distinct = array.Distinct().OrderBy(x => x);
foreach (int i in Distinct)
{
int count = array.Where(x => x == i).Count();
_FrequenceCount[i] = count;
}
var sorted=_FrequenceCount.OrderBy(x=>x.Value);
int lastLenght = 0;
int temp = 0;
foreach(KeyValuePair<int,int> _te in sorted)
{
for(int i=0;i<array.Length;i++)
{
if(array[i]==_te.Key)
{
temp = array[lastLenght];
array[lastLenght] = array[i];
array[i] = temp;
lastLenght++;
}
}
}
for (int i = 0; i < array.Length; i++)
{
Console.WriteLine(array[i]);
}
Console.ReadLine();
}
Palindrome
alta cohesión y bajo acoplamiento

How proficient are you in Dependency injection?*


How proficient are you in SOLID?*
How proficient are you in Generics?*
How proficient are you in Net Core?*
How proficient are you in Azure Fundamentals?*
How proficient are you in Rest Services Advanced?*
How proficient are you in Entity Framework & EF core?*
How proficient are you in Unit testing?*
How proficient are you in Delegates, Linq, Anonymous functions?*

You might also like