473,221 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

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 "EntityObject" 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 2327
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 "xxxxxEntity"
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(methods), 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****@microsoft.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 "EntityObject" 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
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...
5
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...
5
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...
0
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...
1
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...
0
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: ...
2
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...
1
by: nsahu | last post by:
what is runtime entity & load time entity? static storageclass is loadtime entity why?
1
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?
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.