- Open Visual Studio.
- Make sure you have the latest version of the entity framework.
- Create a project or open an existing project (Preferably C# Console Application)
- Right-click the project and choose Add -> New Item…
- Under Visual C# Items select “Data”
- Select the template “ADO.NET Entity Data Model”
- Give it a name and click “Add”
- Select “Generate from database”
- Enter connection info, choose the database objects and Visual Studio will create a model of the database
- Once you have the model ready, you can move around the tables, or create or edit or delete tables, create relationships and ultimately even send those changes to the database.
- For exporting the ER model as an image, just right-click on the blank space, select Diagram, and select Export as image.
The model is stored as a “.edmx” file and will look something like this
Using the Entity Data Model Designer you can even build logical tables from scratch, then create the DDL that can be run on SQL Server to build the physical tables. Or, you can generate the logical tables from an existing SQL Server database – reverse engineering, modify them, and update the physical tables. One other feature is that it creates the .NET code to interact with the tables if you are building an application. In our case, we only need to create an Entity-Relationship diagram of an existing database, so well skip it.
|Using technology to become more nimble and agile is important for all companies today. But it is especially important for firms in China as they strive to establish stronger ties with business partners in the west and Asia|
|After giving presentations on service-oriented architecture (SOA) and Web Services to companies at CeBIT Asia 2004, which took place at the end of April at the Shanghai New International Expo Centre (SNIEC), Mark Glikson, Strategic Architect, Asia Pacific & Greater China Regions for Microsoft, said he was impressed by the sophistication of the Chinese.|
“They realise that SOA is important, that you can’t build buildings without planning them properly,” he added.
Even before Glikson made his presentations, an experienced Chinese professor spoke in English about many of the issues the Microsoft strategic architect was later to raise in his presentations, particularly the relevance of SOA.
Glikson spoke at the CeBIT Asia 2004 Software Development and Architecture Conference. The conference, organised by Masoud Kamali of Germany’s Herausberger dot.net magazine, also attracted speakers from SAP and Borland.
The room was packed for both of Glikson’s presentations. The audience consisted mostly of system integrators (SIs), executives from MNCs and project managers.
“Of course, we have our own Microsoft-organised events where we speak to people that we know already,” said Glikson, explaining why Microsoft participated in the event. “But there are many people that we don’t ordinarily touch base with. An industry event with multiple vendors is good to attend because we don’t want to just preach to the converted.”
Glikson admits that he met a couple of SIs who initially were “very anti-Microsoft”. He sat down with them over dinner and discussed their problems.
“They had developed a perception about what Microsoft is without actually researching this in a deeper way, which we find is quite a common and regular occurrence,” said Glikson. “By the end of the dinner, I think I had changed their perceptions.”
Asked why he had decided to organise the Software Development and Architecture Conference at CeBIT Asia, Kamali said: “I have read somewhere that Shanghai alone needs 100,000 more software developers by the end of 2005. It is important for the world to find out what Chinese software developers are up to, and to put China in touch with the wider world.”
He went on: “It was crucial to have Microsoft’s involvement because it is one of the most important software companies that set and push standards in the software industry. Every serious software architect should know about Microsoft’s road map for the future.”
For Microsoft, the shift to services-based computing and SOA is the next major transition in enterprise computing after the move from the mainframe model to client-server computing, and then to the browser-based architectures of the Internet.
Permissions View Tool is shipped with .Net FrameWork. This tool is used to view the Declarative and Requested permissions set on an assembly.
So let us create an assembly set some requested and declarative permissions on it and view them with Permview.
Let us start by creating an assembly and setting some Requested permissions on it.
1) Open a new WindowsApplication.2) Add a button to the form named Button1.3) Add a Class to this Application Named MyClass.4) Add a method to this class named Add which adds to numbers and returns the result.5) In the Button Click event of Button1 call the Add method of the MyClass as shown below.
MyClass myClass = new MyClass(); MessageBox.Show(myClass.Add(1,2).ToString());
6) Run the application. click on the Button and you will get the result as “3”.Now we will add requested permission to this assembly.
7) Go to AssemblyInfo.cs and add the below lines
[assembly: FileIOPermission(SecurityAction.RequestMinimum,Write=”c:\\”)][assembly: UIPermission(SecurityAction.RequestRefuse, Window = UIPermissionWindow.AllWindows)]
By setting these permissions we say that to execute this application minimum write permission on C: is required. Along with that we have also requested an another UI permission which refuses to show any windows on the screen hence no forms or message boxes will be displayed.
8) Run the application. The form will not be loaded instead you will see the below error message:
Additional information: Request for the permission of type System.Security.Permissions.UIPermission, mscorlib, Version=1.0.3300.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
9) We can vew the permissions set on an assembly with permview.exe.10) Go to VS.Net command prompt and go to the folder which contains your application exe.11) Type the following command :permview WindowsApplication2.exe 12) You will see all the permissions set on the assembly as below:
minimal permission set:
optional permission set: Not specified
refused permission set:
13) Since we have set RequestRefuse permission for UIPermission we were unable to see the form so let us change that to RequestOptional as follows :
[assembly: UIPermission(SecurityAction.RequestOptional, Window = UIPermissionWindow.AllWindows)]
These permissions on the assesmbly that we saw were erquested permissions on the assembly. Permview is also used to view declarative security on classes or methods.
15) Let us add Declarative security to our MyClass as follows:
[PrincipalPermission (SecurityAction.Demand, Role=”Administrator”)] // add this above the class declaration
16) According to the above permission only those users who belong to the “Administrator” role will be able to instantiate this class or call any method on this class.
17) Let us view the declarative security of this class.18) Go to the VS.NET command prompt and type the following command : permview /decl WindowsApplication2.exe.
Note : – “/decl” shows the declarative permissions set on the classs and methods of the assembly.
19) You will see the class declarative permissions (as shown below) along with the requested assembly permissions.
Class WindowsApplication2.Class1 NonCasDemand permission set:
20) You will be able to execute the method call if the current user is an Administrator on the machine.
In this way we can use Permview.exe to view the declarative and requested permissions set on any assembly.
There are 3 types of requested permissions which can be granted on assembly :
Minimum permissions: (RequestMinimum) Permissions your code must have in order to run. Optional permissions: (RequestOptional) Permissions your code can use, but can run effectively without. Refused permissions: (RequestRefuse) Permissions that you want to ensure will never be granted to your code, even if security policy allows them to be granted.
— Please post your queries and comments for my articles in the usergroup for the benefit of all. I hope this step from my end is helpful to all of us.