Neo.NET Entity Objects Patterns and Best Practices Copyright © 2002-2003 Erik Dörnenburg – Last updated: December 2003.

Slides:



Advertisements
Similar presentations
Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
Advertisements

Main Title Here Additional copy here, additional copy here, additional copy here, additional copy here, additional copy here. ADD YOUR WEB ADDRESS HERE.
And so to Code. Forward, Reverse, and Round-Trip Engineering Forward Engineering Reverse Engineering Round-Trip Engineering.
Templates in C++. Generic Programming Programming/developing algorithms with the abstraction of types The uses of the abstract type define the necessary.
Neo.NET Entity Objects VisualStudio Tool Guide.
Class template Describing a generic class Instantiating classes that are type- specific version of this generic class Also are called parameterized types.
Relational Databases What is a relational database? What would we use one for? What do they look like? How can we describe them? How can you create one?
What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application.
Neo.NET Entity Objects Design Goals Copyright © Erik Dörnenburg – Last updated: May 2004.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
2.3 Organising Data for Effective Retrieval
1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8 Reporting from Contract.
 Michael Bernstein Principal Software Design Engineer Microsoft Corporation.
Building Search Portals With SP2013 Search. 2 SharePoint 2013 Search  Introduction  Changes in the Architecture  Result Sources  Query Rules/Result.
Software Design Patterns (2) four commonly used design patterns using php (singleton, factory, adapter & decorator)
Software reuse means to “borrow” existing code. How can you reuse an existing class to make a new one? Such reuse is really an adaptation -- using the.
Logics for Data and Knowledge Representation SPARQL -- Exercises Feroz Farazi.
1 CA202 Spreadsheet Application Publishing Information on the Web Lecture # 15 Dammam Community College.
Getting the most out of ArcGIS Web Application Templates
A Simple Java Relational Database Thomas A. Bullinger March 20, 2001
Chapter 38 Persistence Framework with Patterns 1CS6359 Fall 2011 John Cole.
Entity Framework Query Generation – LINQ-syntax – Auto-compilation Database Access – Single context during page interaction – —————— Less code – ————————
Example Consider the following class specification for a class that stores a bunch of characters. /* class invariant *this bunch contains one or more char.
FHIR Server Design Review Brian Postlethwaite HEALTHCONNEX October 2015.
CONTENTS Add your title welcome to use these powerpoint templates, New Content design, 10 years experience Add your title welcome to use.
Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab guide #5.
Main Title Here Additional copy here, additional copy here, additional copy here, additional copy here, additional copy here. ADD YOUR WEB ADDRESS HERE.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 15 Inheritance.
March 1, 2004CS WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004.
AICC Meeting – Minneapolis, MN June 24, 2003 Benefits of Reusable Objects – Design/Development Flexibility Design for Multiple Contexts Smallest Media.
Singleton Pattern. Problem Want to ensure a single instance of a class, shared by all uses throughout a program Context Need to address initialization.
Random Logic l Forum.NET l State Machine Mechanism Forum.NET 1 st Meeting ● December 27, 2005.
Neo.NET Entity Objects Architecture and Implementation Copyright © Erik Dörnenburg – Last updated: December 2004.
CS 241 Discussion Section (02/02/2012). MP2 Overview  Task is simple  Reimplement malloc(), calloc(), realloc() and free()  A contest will be running.
Introduction to ORM Hibernate Hibernate vs JDBC. May 12, 2011 INTRODUCTION TO ORM ORM is a programming technique for converting data between relational.
Pseudo-code. Pseudo-code Task 1 Preparation Use the following code to declare, initialise and populate an array in a new VB.NET console application:
BIT 286: Web Applications ASP.Net MVC. Objectives Applied MVC overview Controllers Intro to Routing Views ‘Convention over configuration’ Layout files.
In this session, you will learn to: Create and manage views Implement a full-text search Implement batches Objectives.
Database Programming Code Dissection. Layered Approach Presentation (Activity) DbSampleActivity.java DataAccess (DataSource) CommentsDataSource.java MySQLiteHelper.java.
Dr. Alexandra I. Cristea SPARQL Exerciess.
Test Title Test Content.
Exercise: How to create a Blog
Java SWING and Model View Controller (MVC)
Data Transport for Online & Offline Processing
Beyond the BDC\BCS Model
Creational Pattern: Prototype
Percent of qualified leads that have only marginal follow-up: 40%
Consider a Direct Mapped Cache with 4 word blocks
Free MB6-704 Actual Tests - MB6-704 Actual Dumps PDF
Download Microsoft Exam Dumps - Valid Microsoft Question Answers - Realexamdumps.com
A. Author, A. Author, A. Author, A. Author, A. Author, A. Author,
Explain the difference between a species and a population

A technical look at the new capabilities
10.5.
Medications Utilities – Mass Void Medications
СИСТЕМТ ТЭГШИТГЭЛ.
The Presentation Title
Developing and testing enterprise Java applications
Main Title Here ADD YOUR WEB ADDRESS HERE
Disbursements and Travel Services Creating an Expense Report from a Travel Authorization & Copying an Expense Report FAR Meeting – July 27, 2016.
How to transfer information into your science fair log books.
title: Arial, 40 of word size
Title Introduction: Discussion & Conclusion: Methods & Results:
Capture and Publish Knowledge
2019 PowerPoint Template powerpoint template designed by freeppt7.com.
Why We Need Car Parking Systems - Wohr Parking Systems
Types of Stack Parking Systems Offered by Wohr Parking Systems
Add Title.
Presentation transcript:

Neo.NET Entity Objects Patterns and Best Practices Copyright © Erik Dörnenburg – Last updated: December 2003

Neo 1Contents 1.Use protected relations 2.Provide custom queries 3.Provide transparent many-to-many relations 4.Use entity maps sparingly

Neo 2Use protected relations Task: Given a publisher find all its titles Worst case: Implementation using factories directly in code-behind or some controller. MyController.cs TitleFactory f = new TitleFactory(myContext); TitleList l = f.Find("Publisher = {0}", pub);

Neo 3Use protected relations Improvement 1: Declare an iref in schema and use public relation. MyController.cs TitleRelation l = pub.Titles; or a copy if it MyController.cs TitleList l = new TitleList(pub.Titles);

Neo 4Use protected relations Improvement 2: Make relation protected (in the template for base classes) and provide accessors Publisher.cs public TitleList GetTitles() { return new TitleList(this.Titles); } public void AddTitle(Title aTitle) { this.Titles.Add(aTitle); } MyController.cs TitleList l = pub.GetTitles();

Neo 5Provide custom queries Task: Given a publisher find all its titles with additional criterion Worst case: Implementation using qualifiers directly in code-behind or some controller. MyController.cs TitleFactory f = new TitleFactory(myContext); TitleList l = f.Find("Publisher = {0}" + "and Royalties > 1000", pub);

Neo 6Provide custom queries Improvement 1: Move code into entity object. Publisher.cs public TitleList GetTitlesWithMinRoyalty(int r) { /* several options */ } MyController.cs l = pub.GetTitlesWithMinRoyalty(1000);

Neo 7Provide custom queries Option 1: Move query as is. Publisher.cs public TitleList GetTitlesWithMinRoyalty(int r) { TitleFactory f = new TitleFactory(Context); TitleList l = f.Find("Publisher = {0}" + "and Royalty > {1}", this, r); return l; }

Neo 8Provide custom queries Option 2: Use internal relation; elegant and caching behaviour but has to bring all titles for publisher into memory. Publisher.cs public TitleList GetTitlesWithMinRoyalty(int r) { return this.Titles.Find("Royalties > {0}", r); }

Neo 9Provide custom queries Option 3: Use internal relation and handwrite loop with comparison; improved performance over option 2 but slightly more code. Publisher.cs public TitleList GetTitlesWithMinRoyalty(int r) { TitleList l = new TitleList(); foreach(Title t in this.Titles) if(t.Royalty > r) l.Add(t); return l; }

Neo 10Provide transparent many-to-many Task: Given a title find all its authors Solution: Add a method to Title. Title.cs public AuthorList GetAuthors() { AuthorList l = new AuthorList (); foreach(TitleAuthor ta in this.TitleAuthors) l.Add(ta.Author); return l; }

Neo 11Provide transparent many-to-many Solution: Add a method to author and/or title. Author.cs public void AddToTitle(Title title) { TitleAuthorFactory f = new Title…(Context); TitleAuthor ta = f.CreateObject(title, this); } Title.cs public void AddAuthor(Author author) { TitleAuthorFactory f = new Title…(Context); TitleAuthor ta = f.CreateObject(this, author); }

Neo 12EntityMaps Use entity maps sparingly and access through context: IEntityMapFactory f = context.EntityMapFactory; IEntityMap map = f.GetMap(typeof(Title));