c# - How can I convert this SQL to LINQ -


i've created code-first database , question i'm having difficulty transcribing sql statement c# code.

below there's sql statement require on adapting , tables use. objective of sql query on table tableviewedmessagelog record of user saw message , desired effect select messages non-read (which information stored on table -- tableviewmessagelogs) user.

http://gyazo.com/0105c0959bdd2930272bf5c07a112a11

select * tablemessages tm tm.id not in (select tv.message_id tableviewedmessagelogs tv tv.user_email = 'asd@asd') 

try this:

var data = (from e in context.tablemessages             context.tableviewedmessagelogs                      .where(x => x.user_email == 'asd@asd')                      .select(x => x.message_id).contains(e.id) == false             select e)            .tolist(); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -