0% found this document useful (0 votes)
5 views13 pages

Enterprise System Paper1

The document covers various concepts related to enterprise systems, including DataReader, Entity Data Model, delegates, WSDL vs. SOAP, XML syntax, and Web APIs. It explains the Model-View-Controller (MVC) framework, its components, uses, and advantages, as well as how to define variables in JavaScript. Additionally, it includes examples and details about application structure and configuration files in ASP.NET MVC.

Uploaded by

manahilsohail645
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views13 pages

Enterprise System Paper1

The document covers various concepts related to enterprise systems, including DataReader, Entity Data Model, delegates, WSDL vs. SOAP, XML syntax, and Web APIs. It explains the Model-View-Controller (MVC) framework, its components, uses, and advantages, as well as how to define variables in JavaScript. Additionally, it includes examples and details about application structure and configuration files in ASP.NET MVC.

Uploaded by

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

Enterprise Systems (Spring24)

Q.1. What is Data reader?


A DataReader is an object that provides a fast, forward-only, and
read-only way to retrieve data from a database.
Forward-only:
You can only read data one row at a time, and only forward.You
cannot move backward in the data.
Read-only:
You cannot update data using a DataReader.It is only used to fetch
data.
Syntax Example (C#)
Q.2. What is entity data model?
The Entity Data Model (EDM) is a conceptual framework that describes
the structure of data in a database, specifically within the context of
Entity Framework. It serves as an abstraction layer that enables
developers to work with data as objects rather than directly interacting
with the underlying database tables.
Key Aspects of EDM:
Entities: Represents the data objects (e.g., tables) within the
application domain.
Relationships: Defines how entities are related to one another (e.g.,
one-to-many, many-to-many).
Attributes: Corresponds to the properties of the entities, reflecting
the columns in the database.
Mapping: Bridges the conceptual model with the database schema
through mapping specifications.
We need to consider 3 core parts that form the basis of the Entity
Framework and collectively it is known as the Entity Data Model.
The following are the three core parts of EDM.
The Storage Schema Definition Model (SSDL)
The Conceptual Schema Definition Layer (CSDL
Q.3. What is a delegate in enterprise systems?
In enterprise systems, a delegate refers to a type-safe function pointer
used primarily in the context of the .NET Framework. It allows methods
to be passed as parameters, enabling event handling and callback
mechanisms. Here are the main features and uses of delegates:
Key Features of Delegates
Type Safety: Delegates are strongly typed, meaning they can only
reference methods with a specific signature (the same return type and
parameters). This ensures that the method signature matches when
invoking the delegate.
Encapsulation: Delegates encapsulate a method, allowing you to
treat methods as first-class citizens, meaning they can be assigned to
variables, passed as parameters, and returned from other methods.
Multicast: Delegates can reference more than one method at a time,
allowing multiple methods to be invoked in a single delegate call.
This is useful for event handling, where multiple subscribers can
respond to an event.
Common Uses of Delegates
Event Handling: In enterprise applications, delegates are often used
to handle events. For instance, a button click event can be tied to a
method using a delegate, allowing the method to be called
automatically when the event occurs.
Callback Mechanisms: Delegates enable callback patterns, where a
method can pass a delegate to another method to be called later, such
as in asynchronous programming scenarios.
Loose Coupling: They facilitate loose coupling in systems by
allowing components to communicate without needing to know about
each other’s implementations.
Example in C#

Q.4. Write difference between WSDL and SOAP?


Exampl <definitions> <soap:Envelope>
e <message <soap:Body>
name="GetDataRequest <GetData><id>
"><part name="id" 123</id></GetD
type="int"/></message ata>
> </soap:Body>
<message </soap:Envelope
name="GetDataRespons >
e"><part name="data"
type="string"/></messa
ge>
</definitions>

Q. 5. What is the syntax of XML?


XML (eXtensible Markup Language) is a markup language used to
store and transport data. It is both humanreadable and machine-readable,
making it an ideal choice for representing structured information. XML
is widely used in various applications, including web services,
configuration files, and data interchange between systems.
Syntax of XML
XML (eXtensible Markup Language) follows a strict syntax that
includes the following rules:
Root Element: An XML document must have a single root element
that contains all other elements.
Elements: Elements are defined with a start tag and an end tag
(e.g., <element>content</element>).
Attributes: Elements can have attributes defined in the start tag
(e.g., <element attribute="value">content</element>).
Well-formedness: XML documents must be well-formed, meaning:
Tags must match (e.g., <tag>...</tag>).
Properly nested elements (e.g., <a><b></b></a>).
Quotes around attribute values.
Case Sensitivity: XML is case-sensitive
(i.e., <Example> and <example> are different).
Example of an XML Document
<?xml version="1.0" encoding="UTF-8"?>

<book>

<title>XML Development</title>

<author name="John Doe" />

<price>29.99</price>

</book>

Q.6. What is a Web API?


A Web API (Application Programming Interface) is a set of rules and
protocols that allows different software applications to communicate
with each other over the web. It enables developers to access the
functionality of a service or application using standard web protocols.
Endpoints: An endpoint is a specific URL where the API can be
accessed. Each endpoint corresponds to a particular resource or action
(e.g., retrieving a list of books).
HTTP Methods:
GET: Retrieve data from the server (e.g., get a list of users).
POST: Send data to the server to create a new resource (e.g., add a
new user).
PUT: Update an existing resource (e.g., update user information).
DELETE: Remove a resource from the server (e.g., delete a user).:
Request: When a client makes a call to a Web API, it sends an HTTP
request to a specific endpoint, which may include parameters and
data.
Response: The server processes the request and sends back an HTTP
response, which contains the requested data or confirmation of the
action taken.
Status Codes: Each response from a Web API includes an HTTP
status code that indicates the result of the request. Common status
codes include:
200 OK: The request was successful.
201 Created: A new resource was successfully created.
400 Bad Request: The request was invalid.
404 Not Found: The requested resource could not be found.
500 Internal Server Error: An error occurred on the server.
Example Use Case of a Web API:
A RESTful Web API for a book store might allow clients to:

Retrieve a list of books ( GET /books )

Add a new book ( POST /books )


Update a book's information ( PUT /books/{id} )

Delete a book ( DELETE /books/{id} )

LONG ANSWERS
Q.1. What is MVC? Write its uses and
advantages.

ASP.NET MVC (Model-View-Controller) is a framework for


building web applications using the Model-ViewController
architectural pattern. It provides a structured and easier way to
manage complex applications.
MVC stands for Model, View, and Controller. MVC separates an
application into three components –
Model,View, and Controller
MVC Components
Model:
The Model is responsible for representing the application's data
and business logic. It retrieves and stores data from a database,
ensuring that the application can manage its core functionality
effectively

View:
The View serves as the user interface, displaying data to users
and allowing them to modify it. It is composed of HTML, CSS,
and Razor syntax, which facilitates communication with the
Model and Controller
Controller:
The Controller manages user requests and processes them
accordingly. It acts as an intermediary between the Model and
the View, handling incoming HTTP requests and determining
which Model to use, ultimately returning the appropriate View
as a response.
Controller is the request handler
The following figure illustrates the interaction between Model, View,
and Controller

MVC Application Structure


App_Data
The App_Data folder is used to store application data files,
including databases and other relevant data files. It provides a
location for files that can be used by the application, such as
LocalDB and XML files.
App_Start
The App_Start folder contains configuration files that execute
when the application starts. These typically include settings for
authentication, routing, and bundling, critical for setting up the
application’s initial state.
Content
The Content folder holds static files, including CSS stylesheets,
images, and icons. These files contribute to the visual styling
and presentation of the web application.
Controllers
The Controllers folder contains class files for controllers, which
handle user requests. Each controller processes actions initiated
by users and returns the appropriate responses to the views.
Models
The Models folder houses model class files that define the
structure of the application's data. These classes typically
contain public properties that allow for data manipulation and
management throughout the application.
Scripts
The Scripts folder includes JavaScript or VBScript files
necessary for client-side functionality. This allows for enhanced
interactivity and dynamic behavior on the user interface.
Views
The Views folder contains .cshtml files that form the user
interface of the application. Each controller typically has its
own subfolder within Views to organize related views
effectively.
Global.asax
The Global.asax file is crucial for managing application
lifecycle events. It enables developers to execute code in
response to events such as application start, error handling, and
session management.
Packages.config
The Packages.config file tracks the NuGet packages and their
respective versions used within the application. It helps manage
dependencies and ensures that the application has access to the
necessary libraries.
Web.config
The Web.config file is an XML-based configuration file
responsible for managing website settings. It allows for
configuration adjustments without restarting the application,
streamlining the development and deployment process.

Uses of MVC:
Separation of Concerns: By separating the application into three
components, MVC allows for easier management and improved
modularity.
Maintainability: Changes to any part (Model, View, Controller) can
be made independently without affecting the others.
Testability: MVC allows for easier unit testing, especially for the
Model and Controller, since they can be tested separately from the
View.
Scalability: It is easier to scale applications as they grow, allowing
for the addition of new features without major overhauls.

Q.2. How we define variables in


JavaScript? Write a program in
JavaScript to calculate the factorial of a
number

In JavaScript, variables can be defined using the keywords:

var – old way, function-scoped

let – block-scoped (preferred for variable values that change)

const – block-scoped and used for constants (values that don’t


change)

var – (Old way)

The var keyword was traditionally used in JavaScript before the


introduction of ES6. It allows you to declare a variable that is
function-scoped, which means it is accessible throughout the entire
function in which it is defined. Variables declared with var can be re-
declared and updated, but this can sometimes lead to unexpected
behavior, especially in larger codebases.

For example:

let – (Modern and Preferred)

The let keyword was introduced in ES6 and is now the preferred way to
declare variables that may change later. Unlike var, let is block-scoped,
which means the variable is only accessible within the block ({}) where
it is declared. Variables declared with let can be updated but cannot be
re-declared in the same scope.

For example:
3. const – (For Constants)

The const keyword is also introduced in ES6 and is used to declare


variables whose values should not change. Like let, it is block-scoped.
Once a variable is assigned a value using const, it cannot be reassigned
or re-declared. It must also be initialized at the time of declaration.

For example:

JavaScript Program to Calculate Factorial of a Number

You might also like