Today I tried both the LINQ and Entity Framework respectively. I used MySQL and didn't want to use dblinq. So I tried to use the LINQ and entity together and wrote a simpleCodeAs shown below, we are pleasantly surprised to find that it can run.
In fact, I have been testing whether to easily control the connection and query of databases like ADO. net in the past after using LINQ and entity, and whether it will be as handy as writing SQL statements.
However, there are so many people who recommend it. I think there will always be some value for reference. I will study it from today on :)
1 Youhuisouentities1 Context = New Youhuisouentities1 ();
2
3 Int Num = Context. Products. Count < Products > ();
4 Console. writeline (Num. tostring ());
5
6 VaR Q = (From products P In Context. Products
7 Where P. cityid > 1
8 Select P). firstordefault ();
9
10 Console. writeline (Q. companyintroduction );