I have an entity "POST" on my context and the following:
String[] keywords = new String[] { "Car", "Yellow" };
How can I search all POSTS which title contains the 2 words?
NOTE: keywords can have 1 to 4 words.
The post entity is the following:
public class Post {
public Int32 Id { get; set; }
public DateTime Created { get; set; }
public String Text { get; set; }
public String Title { get; set; }
public DateTime Updated { get; set; }
} // Post
And here is my SQL:
create table dbo.Posts
(
Id int identity not null
constraint PK_Posts_Id primary key clustered (Id),
Created datetime not null,
[Text] nvarchar (max) not null,
Title nvarchar (120) not null,
Updated datetime not null
);
I have been looking at LIKE in SQL but what is the equivalent in Entity Framework?
Do I need Full Text Search? And is it available in SQL Server 2012 Express?
UPDATE
Following haim770 suggestion I tried the following:
Context context = new Context();
String[] words = new String[] { "Car" };
List<Post> posts = context.Posts.Where(x => words.Contains(x.Title).ToList();
No posts were returned with this ... Any idea?
Thank You, Miguel