Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to relate a SQL based entity with an Object based entity in Entity Framework

Reply
Thread Tools

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

 
 
markla
Guest
Posts: n/a
 
      10-03-2008
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

 
Reply With Quote
 
 
 
 
Steven Cheng
Guest
Posts: n/a
 
      10-06-2008
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:
http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
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" <(E-Mail Removed)>
>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
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Entity Framework - Reassigning child entity's parent Norm ASP .Net 3 07-06-2009 07:28 PM
How to relate bound GridView columns to an unbound checkbox in the same row? keithb ASP .Net 1 04-08-2006 05:31 PM
How to relate MCSE with business environment =?Utf-8?B?S0Y=?= MCSE 7 02-21-2006 07:11 PM
How does sATA and pATA hard-disk drive letter order relate? Jimmy Dean Computer Support 1 07-03-2004 09:04 AM



Advertisments