Using Entity Framework within a Class Library DLL

Using Entity Framework within a Class Library DLL


This short video walks you through how to use the Entity Framework inside of a Class Library DLL so that you can reuse the Library in multiple projects.

Source Code: http://www.digioz.com/downloads/tutor...
Northwind Database: http://northwinddatabase.codeplex.com/
Website: http://www.digioz.com
Closed Caption:

in this video I will walk you through
how to use the entity framework from
within a library project in visual
studio to begin we will create a new
project and this type we will create a
windows forms application and i will
name this BF within PL so the first
thing we will do this is a standard
windows application
the first thing we will do is we will
add a class library so a new project of
type class library and I'm just going to
accept the default name here and we
don't need this demo class that created
so i have a database called north wind
which you can download at the link that
i've specified in the tutorial i will
add a new item to the library of that
data and it's an A do that net entity
data model and i'm going to call this
north wind generated from database is
fine
so here I'm going to create a new
connection of types equals fine and i
will use local host
and sa password and i will select the
Northwind database test connection yup
it works so what I want now to do it
will create the entities object and it
will also create an app that config file
so i will select YES include the
sensitive data in a connection string
and save entity connection settings and
app.config as this so next next I want
to choose all the tables in this case we
could also include all the views and
stored procedures and stored procedures
also in this case we can include all of
them even though i'm not going to use
all of them
ok so the next step is to click finish
and it will go through and it'll
generate the tables views and stored
procedures that will generate classes
for each of them so here's at once
everything is said and done here is what
you'll see you'll see a diagram while
the tables there in this database and I
if you look at the class library there's
a north wind project
DMX if you might and if you expand the
north wind at TT you will see all the
classes for the various objects the one
I'm interested in is the employees
object so what I'm going to do
now is take a look at the app config
file notice here it has a connection
string for Northwind database now
there's one piece of information that we
have to change and that's this inside of
the string you'll see a double-a a
person quote you have to replace that
with a single quote and the same for the
ending you have to change that to a
single cold as well and that's it
so now that we have this entry framework
access we will go to our regular windows
application here and now let's just drop
a combobox in here and we will reference
the class library that we have and
there's a couple of different things
that I'm going to have to reference here
one of them is the entity framework so i
will have to first get the path to this
class library here
actually let's expand the references
folder and find a path to the entity
framework LOL and i'm going to have to
reference this dll in my windows
projects
so I'm going to say ok alright and so
here now I have the entity framework the
other thing that I need is a system data
data entity so I let's look at the
Assembly's here
system.data entity i'm also going to
reference system data entity and system
entity did design against the framework
uses that the other thing I'm going to
have to do is right click and add a new
item and this is a configuration file
and i'll click Add and uh we're going to
have to copy everything that we have in
this file dia app.config that came with
our class library and copied here okay
and now we're ready to access our
library so here on the forum i'm first
going to create a very well fertile
first less a day using statement to our
class library
and then here i should have a north wind
entities object i will call this fellow
and and here let's first initialize this
object to a new Northland entities
object and i will list the employee i'll
create a list of employees call it
employs equals to follow Northwind that
em ployees to list and what this does is
it grabs a list of all employees in the
database from the employees table and my
combobox i'll set the data source of it
to allow employees and also let's set
the display member to first name
so that's all the code i need is a
compile it first to see if everything
can pass correctly and it does so we
will now run this windows application to
see if we get any results
alright it looks like we got all the
names from the database so our end and
the framework is not working within the
class library and we're good to go now
one point of caution here is when you
set the run type to debug actually
references the app config file that's
residing within the class library right
here which may or may not be the same as
the app.config a connection string that
you've put inside of your windows
application but as soon as I flip the
switch to release it now fetches it from
the place where it references the class
library so which would be here so when i
run it now this time around is getting
the connection string and the
information from my windows application
form so be careful when you are a
reference the library you have to have
this information in both places in order
for this to work
that's all I have please subscribe and
leave any comments or questions you may
have and thank you for watching

Video Length: 10:29
Uploaded By: DigiOz Multimedia
View Count: 13,041

Related Software Products
ClassLibrary
ClassLibrary

Published By:
Online TV

Description:
ClassLibrary is the ultimate code library for developers, teams, and enterprises. It provides the best collection of ready-to-use code snippets, classes, how-to`s, and articles. It also allows you to manage your own code and share knowledge within a team by using the fully searchable code repository. ClassLibrary provides both a full-featured standalone Code Explorer,is the Ultimate Code Library for Programmers. Get a jumpstart into programming with thousands of lines of C# and Visual Basic ...


Related Videos
Bollywood Class Library Flash Mob
Bollywood Class Library Flash Mob

Northwestern's Bollywood "Cultural Forms" class puts on a study break show for students studying in the university library.
Video Length: 04:09
Uploaded By: NUBollywoodDance
View Count: 102,127

Insert,Update,Delete,Select using Three Tier demo using ClassLibrary
Insert,Update,Delete,Select using Three Tier demo using ClassLibrary

Three Tier Architecture Demo for INSERT UPDATE DELETE SELECT
Video Length: 31:33
Uploaded By: Hitesh Rathod
View Count: 33,143

VB.NET Tutorial - Create a DLL / Class Library (Visual Basic .NET)
VB.NET Tutorial - Create a DLL / Class Library (Visual Basic .NET)

In this Visual Basic .NET tutorial I will be showing you how to create and use your own DLL (Dynamic Link Library) in your VB.NET projects. We will create a DLL file for managing form graphics and use that DLL to draw images to forms and form controls. TUTORIAL FEATURES: DLL - Library, Namespace, Class Graphics - System.Drawing, Image Form Controls - Button, PictureBox Class - Image Manager hr / bClosed Caption:/b welcome to the vb ...
Video Length: 32:29
Uploaded By: VB Toolbox
View Count: 29,826

Tutorial - Visual Basic 2010 - How to make a dll/Class Library - L3GiT
Tutorial - Visual Basic 2010 - How to make a dll/Class Library - L3GiT

This video is a tutorial on how to make a .dll also known as an application extension ALSO known as a Class Library in Visual Basic 2010 (.NET 4.0). If you are in need to know how to make a Class Library you probably already decent at programming, but if your not that is still okay as I went over some key features such as Sub and Subs being Private or Public as well as Functions being Private, Public and Public Shared. Private Sub or Private Function: If you see the word ...
Video Length: 10:16
Uploaded By: CmptrPrgmr
View Count: 20,873

Creating C# .NET Class Library Assembly Versions and Installing in the GAC Part 1 of 3
Creating C# .NET Class Library Assembly Versions and Installing in the GAC Part 1 of 3

Three part video on how to create .NET class library assemblies and handle multiple versions of the code. Also, how to install them into the Global Assembly Cache (GAC) and again, deal with multiple versions. Doug Rees from Black Bear IT is the presenter. hr / bClosed Caption:/b I there my name's degrees I'm gonna be talking to today about dotnet assembly versioning so just a quick overview all summer the issues that we face on working ...
Video Length: 08:48
Uploaded By: BlackBearIT
View Count: 19,605

A Simple Tutorial on using a Class Library and C# application in one Solution.
A Simple Tutorial on using a Class Library and C# application in one Solution.

A Simple tutorial on creating a class library and implementing a class in a C# application in one solution thereof. Just something to get you started no unnecessary detail. hr / bClosed Caption:/b i'm just going to show you guys how to create a cross librarian and basic example on your current track and we'll just use a class library as sort of a container told all our classes and created the aisle from that and with the ll be able ...
Video Length: 10:01
Uploaded By: Mixo Mushwana
View Count: 19,161

Visual Basic 2008 Tutorial: Class Library / DLL
Visual Basic 2008 Tutorial: Class Library / DLL

This video basically teaches you how to write a class library and deploy it in another application. This is my last video for the year of 2009. Lets say hello to 2010. Please comment, rate and subscribe. Please watch in high quality.
Video Length: 05:15
Uploaded By: monsterhunter445
View Count: 15,348

Angell EYE PHP Class Library for PayPal Overview
Angell EYE PHP Class Library for PayPal Overview

This is a quick overview of how to use the Angell EYE PHP class library for PayPal to process payments using Payments Pro, Adaptive Payments, or PayFlow Pro. hr / bClosed Caption:/b high winds and rain Jules angel I swim do a quick overview the using this PHP library for Pay Pal their bill makes it pretty quick and easy to integrate a pulse web services and a pretty much me PHP the project might be working on a pretty ...
Video Length: 07:21
Uploaded By: Andrew Angell
View Count: 12,992

Visual Basic Tutorial - 179 - FTP Downloader Part 2   Referencing A Class Library
Visual Basic Tutorial - 179 - FTP Downloader Part 2 Referencing A Class Library

Facebook - https://www.facebook.com/TheNewBoston... GitHub - https://github.com/buckyroberts Google+ - https://plus.google.com/+BuckyRoberts LinkedIn - https://www.linkedin.com/in/buckyroberts reddit - https://www.reddit.com/r/thenewboston/ Support - https://www.patreon.com/thenewboston thenewboston - https://thenewboston.com/ Twitter - https://twitter.com/bucky_roberts hr / bClosed Caption:/b hello youtube same here from YouTube dotbr ...
Video Length: 05:11
Uploaded By: thenewboston
View Count: 10,116

Copyright © 2025, Ivertech. All rights reserved.