Hi Alexey,
I do have localization field "Name" in a base class. The field "Name" works in other LINQ statements just fine, but not in custom LINQ.. See below my classes.
Thank you,
Richard
[HierarchyRoot]
public class BaseEntity : Entity, ILocalizable<BaseEntityLocalization>
{
[Field, Key]
public int Id { get; private set; }
// Localizable field. Note that it is non-persistent
public string Name
{
get { return Localizations.Current.Name; }
set { Localizations.Current.Name = value; }
}
public BaseEntity(): base()
{
}
public BaseEntity(Session session) : base(session)
{
}
}
[HierarchyRoot]
public class BaseEntityLocalization : Localization<BaseEntity>
{
[Field(Length = 100)]
public string Title { get; set; }
[Field(Length = 100)]
public string Name { get; set; }
public BaseEntityLocalization(Session session, CultureInfo culture, BaseEntity target)
: base(session, culture, target) { }
}
public class Organization : BaseEntity
{
[Field]
public Organization ParentBranch { get; set; }
[Field]
[Association(PairTo = "ParentBranch", OnOwnerRemove = OnRemoveAction.Cascade, OnTargetRemove = OnRemoveAction.Clear)]
public Organization_EntitySet Branches { get; set; }
[Field]
public Address Address {get; set;}
[Field]
public Phone Phone { get; set; }
[Field]
public Phone Fax { get; set; }
[Field (Length=128)]
public string WebUrl { get; set; }
public Organization()
: base()
{
}
public Organization(Session session)
: base(session)
{
}
}
public class Funder : Organization
{
[Field]
public Funder_Client_Entity_Set Clients { get; private set; }
[Field]
public Funder_FamilyGroup_EntitySet FamilyGroups { get; private set; }
[Field]
[Association(PairTo = "Fonder", OnOwnerRemove = OnRemoveAction.Cascade, OnTargetRemove = OnRemoveAction.Clear)]
public Funder_ZipCodes_EntitySet ZipCodes { get; private set; }
public Funder()
: base()
{
}
public Funder(Session session, string Name)
: base(session)
{
this.Name = Name;
}
}
The Following Code works fine..
protected void btnSetVisitorsFunder_Click(object sender, EventArgs e)
{
Xtensive.Orm.Session session = SessionManager.Current.Session;
bool value = (from f in session.Query.All<Funder>() where f.Name.Contains(COICMS_Utils.Get_FunderName(COICMS_Types.Funders_Type.DOC_Jax)) && f.ZipCodes.SingleOrDefault(z => z.ZipCode == "32099") != null select f).FirstOrDefault() != null;
}
answered
Jul 11 '17 at 12:43
rasxte
20●16●16●17