Here are my tables and queries:
select
r.*
from
Framework.StringResource r
where
r.Container = 'AddEditLocations'
ID Container Key
1 AddEditLocations MissingEffectiveStatus
2 AddEditLocations MissingLocationName
select
rv.*
from
Framework.StringResourceValue rv
where
rv.StringResourceID in (1,2)
ID Culture StringResourceID Value
1 en 1 Effective Status is required
2 en 2 Location Name is required
23 fr 1 french Effective Status is required
select
r.Container, r.[Key], rv.Culture, rv.Value
from
Framework.StringResource r
inner join Framework.StringResourceValue rv on r.ID = rv.StringResourceID
where
rv.Culture = 'fr'
and r.Container = 'AddEditLocations'
Container Key Culture Value
AddEditLocations MissingEffectiveStatus fr french Effective Status is required
Here is my genpro code so far...
var prefetchPath = new PrefetchPath2(EntityType.StringResourceEntity)
{
StringResourceEntity.PrefetchPathStringResourceValues
};
var bucketContainer = new RelationPredicateBucket();
bucketContainer.PredicateExpression.Add(StringResourceFields.Container == container);
bucketContainer.PredicateExpression.Add(StringResourceValueFields.Culture == culture);
bucketContainer.Relations.Add(StringResourceEntity.Relations.StringResourceValueEntityUsingStringResourceId);
....
EntityCollection<StringResourceEntity> resources = adapter.FetchEntityCollection(.....);
....
....
StringResourceEntity entity = resources .First(r => r.Key.Equals(key));
// Problem here...
-->string value = entity.StringResourceValues.First(v => v.Culture == culture).Value; <---
How do I get culture value WITH OUT filtering for it in the above line???
Since I am already filtering by container and culture, I want to set up predicate expression such that the 2 tables are joined properly and I only get a single record back AFTER MY DATABASE CALL IS EXECUTED. Is that possible?
How do I set the predicate expression that would in turn result in the following query and in this specific case return back ONLY 1 RECORD??
select
r.Container, r.[Key], rv.Culture, rv.Value
from
Framework.StringResource r
inner join Framework.StringResourceValue rv on r.ID = rv.StringResourceID
where
rv.Culture = 'fr'
and r.Container = 'AddEditLocations'