473,786 Members | 2,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to relate a SQL based entity with an Object based entity in Entity Framework

Hi,

I have an Entity data model built in Entity Framework, which sources data
primarily from an MS SQL 2008 database, and sources some static (data
dictionary) values from code-based objects. I know I *could* store the data
dict values in SQL: for various reasons that's not the path I want to take.

I have some lookups, which are based on code-based Objects. They are
encapsulated in Objects because the values can change during processing, and
are not persisted to the database, and they derive from "EntityObje ct" so
they are EF-ready.

For example, I may have an EF object "Event", and an Object type
"EventType" . Event is stored in the database, however EventType is loaded
depending on what types I support in an application variant (depending on
DLLs loaded).

In looking at the edmx file and other info, I can't see how to mix SQL and
Non-SQL Object based entities.

How can I create an EF relation between the SQL based "Event", and an Object
based "EventType" ?

Thanks in advance for assistance,
+Mark

Oct 3 '08 #1
1 2367
Hi Markla,

As for "mixing the SQL and Non-SQL. object entities", here are some of my
understanding and suggestion.

The ADO.NET entity framework and EDM mainly focus on the object mapping
between code level and backend database source. So generally, the current
tool and IDE support will focus on generating the database to class
mapping. For your scenario that you want to extend the entities so as to
support some class/objects mapping to non-database source, I think you can
just add a partial class code file to extend the generated entity
classes(from database). For example, if you want the main "xxxxxEntit y"
class contains some methods which query a file or calcuate via algorithm on
the fly, you can add a custom method for the class in that partial class
file.

#Customizing Objects (Entity Framework)
http://msdn.microsoft.com/en-us/library/bb738612.aspx

If you want to add not only custom functionality(m ethods), but also classes
that do not directly mapping to any database table, I'm afraid you need to
maintain those classes yourself in different source code file. However ,I
think it is still quite convenient for you to use them together via LINQ
(linq to entity + linq to objects).

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "markla" <ma****@noemail .noemail>
Subject: How to relate a SQL based entity with an Object based entity in
Entity Framework
>Date: Fri, 3 Oct 2008 22:37:35 +1000

Hi,

I have an Entity data model built in Entity Framework, which sources data
primarily from an MS SQL 2008 database, and sources some static (data
dictionary) values from code-based objects. I know I *could* store the
data
>dict values in SQL: for various reasons that's not the path I want to take.

I have some lookups, which are based on code-based Objects. They are
encapsulated in Objects because the values can change during processing,
and
>are not persisted to the database, and they derive from "EntityObje ct" so
they are EF-ready.

For example, I may have an EF object "Event", and an Object type
"EventType" . Event is stored in the database, however EventType is loaded
depending on what types I support in an application variant (depending on
DLLs loaded).

In looking at the edmx file and other info, I can't see how to mix SQL and
Non-SQL Object based entities.

How can I create an EF relation between the SQL based "Event", and an
Object
>based "EventType" ?

Thanks in advance for assistance,
+Mark

Oct 6 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4853
by: Java script Dude | last post by:
Some programmers prefer to stay with native level data structures such as string arrays instead of using Object based data structures such as ArrayList. From and efficiency point of view. Are string arrays the most efficient way of dealing with static tabular data such as query returns? or is it more efficient to use a Recordset type data structure using say ArrayList with a Record objects? (Pardon my JDBC ignorance)
5
1694
by: Tobias Windeln | last post by:
Hi! I'm looking for suggestions on object-based inheritance in Python. Automatic forwarding (often called delegation) in Python is easy: def __getattr__(self, attr): return getattr(self.delegatee, attr) def __setattr__(self, attr, value): return setattr(self.delegatee, attr, value)
5
1473
by: Michal Rizek | last post by:
Hi, i need to use COM object in my application running on Pocket PC 2003. I used tlbimp utility to create clr assembly and added it into my project. But when i try to create instance of COM object BALSYSLib.BalSystemClass sys = new BALSYSLib.BalSystemClass(); InvalidOperationException is thrown. It is even thrown earlier then the program reaches that line - propably JIT compiler throws it (it is thrown while entering procedure...
0
1116
by: Jeff Louie | last post by:
Well I finally finished a Chapter on the use of Type Based and Interface Based Factories at: http://www.geocities.com/jeff_louie/OOP/oop18.htm Happy Holidays, Jeff *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
1
1420
by: Harold | last post by:
Hi all, having a little difficulty binding up a dropdownlist control in a datagrid column. I know I must be missing something Here are 2 methods. One is the DataGrid's ItemDataBound event to catch the grid population event and the other is to populate the dropdownlist I'll start with the method that binds the dropdownlist. As mentioned it is object based and also works fine everywhere but in a template column. I have put in some comments...
0
1206
by: ABC | last post by:
Which function can determine the URI is web-based or File-based filename string? I want a function can determome the file with path is web or file-system-based filename, for example: http://abc.com/docs/123.txt return 'Web-Based'
2
1910
by: Andrus | last post by:
My instantiated entity object base type (entityBase) contains virtual empty validation methods. To implement runtime validation I need to overriide those validation methods after object is created. I need to instantiate new object which is based in existing object but has validation methods overridden. How to implement this ?
1
5185
by: nsahu | last post by:
what is runtime entity & load time entity? static storageclass is loadtime entity why?
1
1611
by: pgupta0609 | last post by:
what are web based and desktop based applications? is web browser a web based or desktop based application and why?
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.