EDM: Adding a table which is not persisted to SQL

  • Thread starter Thread starter markla
  • Start date Start date
M

markla

Hi,

Is it possible to add a table to an EDM which is using the SQL provider (is
that the only provider supported in v1?), and specify that the engine does
NOT try and load or save the data?

Thanks,
+Mark
 
Hi Mark,

If you need in-memory data only then go ahead and create additional classes.
You can extend the existing model via partial classes and EDF will just
ignore the new classes.
 
Hi, thanks for the response...

This approach works for using the EDM in code, however the problem I've had,
and am trying to work around, is Dynamic Data doesn't scaffold partial class
extensions to EDM.

The foreign key relationship to the lookup table should appear as a
drop-down list: unfortunately it uses a text box: work-arounds firstly
negate the benefit of using Dynamic Data, and secondly in my experience so
far have been tricky to add.

Hence- I was hoping to add a non-saved table to the EDM (which would give me
all the relations in EDM and Dynamic Data).

Cheers,
+M

Miha Markic said:
Hi Mark,

If you need in-memory data only then go ahead and create additional
classes.
You can extend the existing model via partial classes and EDF will just
ignore the new classes.
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

markla said:
Hi,

Is it possible to add a table to an EDM which is using the SQL provider
(is that the only provider supported in v1?), and specify that the engine
does NOT try and load or save the data?

Thanks,
+Mark
 
Hello Mark,

I'm not sure that I understand the question rightly. It seems that the
purpose of "adding a non-saved table to EDM" is to work around the issue:
"The foreign key relationship to the lookup table should appear as a
drop-down list: unfortunately it uses a text box."

However, when I do a simple test for the foreign key relationship in EDM, I
see the Dynamic Data site shows a drop-down list on my side, instead of a
textbox. (If you need, I can send my test project to you). May I ask whether
the symptom on your side is related to one of your past thread?

"DynamicData pages and additional fields on an EDM model"
http://www.microsoft.com/communitie...bcc5&mid=baac2ab2-f33d-47a2-80bb-dd9c07dfbcc5

Because as far as I know, the above thread provides a work-around to
override the default render of the lookup field, which may possibly cause
the side-effect: the foreign key relationship shows a textbox.

Mark, please help to check my understanding of the issue. If there's any
wrong with my understanding, would you mind providing more details about the
purpose of "adding a non-saved table to EDM"? To be honest, I am still not
clear about the problem's context, though I sincerely want to help you.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

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:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#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/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

markla said:
Hi, thanks for the response...

This approach works for using the EDM in code, however the problem I've
had, and am trying to work around, is Dynamic Data doesn't scaffold
partial class extensions to EDM.

The foreign key relationship to the lookup table should appear as a
drop-down list: unfortunately it uses a text box: work-arounds firstly
negate the benefit of using Dynamic Data, and secondly in my experience so
far have been tricky to add.

Hence- I was hoping to add a non-saved table to the EDM (which would give
me all the relations in EDM and Dynamic Data).

Cheers,
+M

Miha Markic said:
Hi Mark,

If you need in-memory data only then go ahead and create additional
classes.
You can extend the existing model via partial classes and EDF will just
ignore the new classes.
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

markla said:
Hi,

Is it possible to add a table to an EDM which is using the SQL provider
(is that the only provider supported in v1?), and specify that the
engine does NOT try and load or save the data?

Thanks,
+Mark
 
Thank you for your prompt response. The question is different to the other
answer you have found below: the problem I am having is populating the
drop-down in a DynamicData control, based on a non-SQL data source.
However, when I do a simple test for the foreign key relationship in EDM,
I see the Dynamic Data site shows a drop-down list on my side, instead of
a textbox.

Let me use this as an example: two tables: SocialEvent and SocialEventType

I need to load/update the SocialEvent table from SQL, however the
SocialEventType table contents need to be controlled by code.

(reason: the user attaches DLLs to the application depending on what they're
doing or licensed to do, so the list of SocialEventTypes comes from the DLLs
which are loaded, rather than from within the database, so a new SocialEvent
can only be one of the available SocialEventTypes)

I have added the SocialEventType table via partial classes & extended the
SocialEvent table in EDM with a custom SocialEventType field... however I
can't get it to be picked up by DynamicData (for Entities) as a valid
foreign key, to show the field as a drop-down.

My cunning plan was to have a table set up in EDM with the right
relationships, to stop SQL trying to load/update and instead to populate it
manually.

If this still isn't clear, I'll try asking a simple question: can I create a
table in the CSDL which does NOT map to a SQL table?

Thanks for trying to understand my question.

+Mark


Jialiang Ge said:
Hello Mark,

I'm not sure that I understand the question rightly. It seems that the
purpose of "adding a non-saved table to EDM" is to work around the issue:
"The foreign key relationship to the lookup table should appear as a
drop-down list: unfortunately it uses a text box."

However, when I do a simple test for the foreign key relationship in EDM,
I see the Dynamic Data site shows a drop-down list on my side, instead of
a textbox. (If you need, I can send my test project to you). May I ask
whether the symptom on your side is related to one of your past thread?

"DynamicData pages and additional fields on an EDM model"
http://www.microsoft.com/communitie...bcc5&mid=baac2ab2-f33d-47a2-80bb-dd9c07dfbcc5

Because as far as I know, the above thread provides a work-around to
override the default render of the lookup field, which may possibly cause
the side-effect: the foreign key relationship shows a textbox.

Mark, please help to check my understanding of the issue. If there's any
wrong with my understanding, would you mind providing more details about
the purpose of "adding a non-saved table to EDM"? To be honest, I am still
not clear about the problem's context, though I sincerely want to help
you.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

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:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#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/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

markla said:
Hi, thanks for the response...

This approach works for using the EDM in code, however the problem I've
had, and am trying to work around, is Dynamic Data doesn't scaffold
partial class extensions to EDM.

The foreign key relationship to the lookup table should appear as a
drop-down list: unfortunately it uses a text box: work-arounds firstly
negate the benefit of using Dynamic Data, and secondly in my experience
so far have been tricky to add.

Hence- I was hoping to add a non-saved table to the EDM (which would give
me all the relations in EDM and Dynamic Data).

Cheers,
+M

Miha Markic said:
Hi Mark,

If you need in-memory data only then go ahead and create additional
classes.
You can extend the existing model via partial classes and EDF will just
ignore the new classes.
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Hi,

Is it possible to add a table to an EDM which is using the SQL provider
(is that the only provider supported in v1?), and specify that the
engine does NOT try and load or save the data?

Thanks,
+Mark
 
Hi, I think I've found a good enough work-around, by creating a new field
template in dynamic data, to perform the lookup of a collection of data. I
think the issue is a shortcoming of the release, along with the other
shortcomings, due to being a 1st version release... we should be able to
relate data from different sources using EDM/DynData with full EDM/DynData
support... excuse my frustration, I am trying to spend time on my business
problem and keep getting caught up spending more time on work-arounds for
EDM and Dynamic Data issues....

I'm still interested if there is a way to mark specific tables in an EDM to
not use SQL for load/update.

Thanks,
+M


markla said:
Thank you for your prompt response. The question is different to the other
answer you have found below: the problem I am having is populating the
drop-down in a DynamicData control, based on a non-SQL data source.
However, when I do a simple test for the foreign key relationship in EDM,
I see the Dynamic Data site shows a drop-down list on my side, instead of
a textbox.

Let me use this as an example: two tables: SocialEvent and SocialEventType

I need to load/update the SocialEvent table from SQL, however the
SocialEventType table contents need to be controlled by code.

(reason: the user attaches DLLs to the application depending on what
they're doing or licensed to do, so the list of SocialEventTypes comes
from the DLLs which are loaded, rather than from within the database, so a
new SocialEvent can only be one of the available SocialEventTypes)

I have added the SocialEventType table via partial classes & extended the
SocialEvent table in EDM with a custom SocialEventType field... however I
can't get it to be picked up by DynamicData (for Entities) as a valid
foreign key, to show the field as a drop-down.

My cunning plan was to have a table set up in EDM with the right
relationships, to stop SQL trying to load/update and instead to populate
it manually.

If this still isn't clear, I'll try asking a simple question: can I create
a table in the CSDL which does NOT map to a SQL table?

Thanks for trying to understand my question.

+Mark


Jialiang Ge said:
Hello Mark,

I'm not sure that I understand the question rightly. It seems that the
purpose of "adding a non-saved table to EDM" is to work around the issue:
"The foreign key relationship to the lookup table should appear as a
drop-down list: unfortunately it uses a text box."

However, when I do a simple test for the foreign key relationship in EDM,
I see the Dynamic Data site shows a drop-down list on my side, instead of
a textbox. (If you need, I can send my test project to you). May I ask
whether the symptom on your side is related to one of your past thread?

"DynamicData pages and additional fields on an EDM model"
http://www.microsoft.com/communitie...bcc5&mid=baac2ab2-f33d-47a2-80bb-dd9c07dfbcc5

Because as far as I know, the above thread provides a work-around to
override the default render of the lookup field, which may possibly cause
the side-effect: the foreign key relationship shows a textbox.

Mark, please help to check my understanding of the issue. If there's any
wrong with my understanding, would you mind providing more details about
the purpose of "adding a non-saved table to EDM"? To be honest, I am
still not clear about the problem's context, though I sincerely want to
help you.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

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:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#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/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

markla said:
Hi, thanks for the response...

This approach works for using the EDM in code, however the problem I've
had, and am trying to work around, is Dynamic Data doesn't scaffold
partial class extensions to EDM.

The foreign key relationship to the lookup table should appear as a
drop-down list: unfortunately it uses a text box: work-arounds firstly
negate the benefit of using Dynamic Data, and secondly in my experience
so far have been tricky to add.

Hence- I was hoping to add a non-saved table to the EDM (which would
give me all the relations in EDM and Dynamic Data).

Cheers,
+M

"Miha Markic" <miha at rthand com> wrote in message
Hi Mark,

If you need in-memory data only then go ahead and create additional
classes.
You can extend the existing model via partial classes and EDF will just
ignore the new classes.
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Hi,

Is it possible to add a table to an EDM which is using the SQL
provider (is that the only provider supported in v1?), and specify
that the engine does NOT try and load or save the data?

Thanks,
+Mark
 
Hello Mark

I discussed the issue with the EDM, and the Dynamic Data teams. They
understand the difficulties you see trying to create a new entity type/set
in the CSDL without persisting it. Using partial class and such is the
right overall strategy. It is possible to create an EDM type to represent
non persisted type as long as it has a relationship to another type that is
persisted in the database. For practical purposes this means we need to
model the FK as a simple scalar Property (as a string sound possible for
you) rather than as an association. i.e. we have to make the
SocialEventType FK a string property of the SocialEvent. At this point from
the EDM / EF perspective everything is valid. In this release of EDM, we
are not able to get Entity Framework to recognize such extra pseudo-tables,
but it is indeed a very good suggestion for the improvements in the future
releases.

Then on the side of dynamic data, we need to manually scaffold that string
property with a dropdown, as you have shown in your workaround.

If you have any other questions or concerns, please DON'T hesitate to tell
me. Thank you very much for your feedbacks and suggestions. They are very
valuable points that we can improve ourselves.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
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:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 
Back
Top