DO 5.0.17

namespace Sample
{
    using System;
    using System.Linq;
    using NUnit.Framework;
    using Xtensive.Core;
    using Xtensive.Orm;
    using Xtensive.Orm.Configuration;

    [HierarchyRoot]
    public class SimpleEntity : Entity
    {
        public SimpleEntity(Guid id)
        {
            Id = id;
        }

        [Field]
        [Key]
        public Guid Id { get; }

        [Field]
        public string Name { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            var dc = new DomainConfiguration("sqlserver",
                "Data Source=.; Initial Catalog=DO40-Tests; Integrated Security=True;");

            dc.Types.Register(typeof(Program).Assembly);

            dc.UpgradeMode = DomainUpgradeMode.Recreate;

            using (var domain = Domain.Build(dc))
            using (var session = domain.OpenSession(SessionType.Default))
            using (session.Activate())
            using (session.OpenTransaction())
            {
                new SimpleEntity(Guid.NewGuid()) { Name = "&&%name" };
                new SimpleEntity(Guid.NewGuid()) { Name = "&%name" };

                var queryable = session.Query.All<SimpleEntity>();

                //&%name
                var ent1 = queryable.Single(z => z.Name.Like("&&&%name", '&'));

                //&&%name
                var ent2 = queryable.ToArray().Single(z => z.Name.Like("&&&%name", '&'));

                Assert.AreEqual(ent1, ent2);
            }
        }
    }
}

asked Sep 25 at 01:56

Gushchin%20Anton's gravatar image

Gushchin Anton
96914

Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA