明月语言专家简介

一、moon.orm旗舰版授权赠送

相关介绍:https://files.cnblogs.com/humble/d.pdf 

(一份全面的官方授权文档,介绍了送大家的东西,建议细细阅读,最好自己动手试试)

Moon.Orm 简介

一、使用sql及存储过程

1)使用List<Dictionary<string, MObject>>

1.使用sql ,体验原生态的感觉

string sql="select * from Class where ClassName = @";
string sql2="select * from Class where DateTimem = @";
List<Dictionary<string, MObject>> mylist=db.ExecuteSqlToDictionaryList(sql,"boy'");
List<Dictionary<string, MObject>> mylist2=db.ExecuteSqlToDictionaryList(sql2,DateTime.Parse("2013-10-10 14:40:08"));
foreach(var oneClass in mylist){
                    string className=oneClass["className"].To<string>();
                    long id=oneClass["Classid"].To<long>();
                    DateTime datetimem=oneClass["datetimem"].To<DateTime>();//不用区分大小写
                    Console.WriteLine(className+"  "+id+"  "+datetimem);
}

2.使用mql,智能感知带来的优雅体验

var  list=db.GetDictionaryList(ClassSet.SelectAll().Where(ClassSet.ClassID.BiggerThan(0)))

 

2)MQL 全面接触

 

2.1 MQL的标准查询

var mm=ClassSet.Select(ClassSet.ClassID,ClassSet.ClassName).

Where(ClassSet.ClassName.Contains("s").And(ClassSet.ClassID.BiggerThan(9)));

 

SELECT [Class].[ClassID],[Class].[ClassName] FROM [Class] WHERE [Class].[ClassName] LIKE @p1  AND  [Class].[ClassID]>@p2 
@p1=%s%
@p2=9

2.2 MQL的嵌套查询(含有Top查询:支持mysql、oracle、postgreSQL、sqlserver、sqlite)

var qiantao=ScoreSet.SelectAll().Where(
                    ScoreSet.UserID.In(UserSet.Select(UserSet.UserID).Where(
                        UserSet.ClassID.In(
                        ClassSet.Select(ClassSet.ClassID).Where(
                                ClassSet.ClassName.Equal(c.ClassName).And(ClassSet.ClassID.BiggerThan(0))
                            )
                        )
                    )
                  ) 
                ).Top(1);
  SELECT TOP 1 [Score].* FROM [Score] WHERE [Score].[UserID] IN (SELECT [User].[UserID] FROM [User] WHERE [User].[ClassID] IN (SELECT [Class].[ClassID] FROM [Class] WHERE [Class].[ClassName]=@p1  AND  [Class].[ClassID]>@p2 ) ) 
@p1=综合测试ClassName2
@p2=0

2.3 MQL的分组查询

var mql=ScoreSet.Select(ScoreSet.ScoreM.Sum().AS("sum"),ScoreSet.TypeName).

Where(ScoreSet.ScoreM.BiggerThanOrEqual(100)).

GroupBy(ScoreSet.TypeName).

Having(ScoreSet.ScoreM.Sum().BiggerThan(300));

 

SELECT SUM([Score].[ScoreM]) AS 'sum',[Score].[TypeName] FROM [Score] WHERE  [Score].[ScoreM]>=@p1  GROUP BY [Score].[TypeName]  HAVING  SUM([Score].[ScoreM])>@p2 
@p1=100
@p2=300

2.4 MQL的连接查询

var m1=ClassSet.Select(ClassSet.ClassID,ClassSet.ClassName)
                    .LeftJoin(
                    UserSet.Select(UserSet.UserID))
                    .ON(ClassSet.ClassID.Equal(UserSet.UserID))
                    .Where(UserSet.UserID.BiggerThan(9));
SELECT [Class].[ClassID],[Class].[ClassName],[User].[UserID] FROM [Class] LEFT JOIN [User] ON [Class].[ClassID]=[User].[UserID]  WHERE  [User].[UserID]>@p1 
@p1=9

2.5 MQL的Union查询

var mql=ClassSet.SelectAll().Where(ClassSet.ClassID.BiggerThan(1))
                    .Union(ClassSet.SelectAll().Where(ClassSet.ClassID.BiggerThan(2)));
 
var mql=ClassSet.SelectAll().Where(ClassSet.ClassID.BiggerThan(1))
                    .UnionAll(ClassSet.SelectAll().Where(ClassSet.ClassID.BiggerThan(2)));

 

SELECT [Class].* FROM [Class] WHERE  [Class].[ClassID]>@p1  UNION  SELECT [Class].* FROM [Class] WHERE  [Class].[ClassID]>@p2 
@p1=1
@p2=2
SELECT [Class].* FROM [Class] WHERE  [Class].[ClassID]>@p1  UNION ALL SELECT [Class].* FROM [Class] WHERE  [Class].[ClassID]>@p2 
@p1=1
@p2=2

2.6 MQL的使用预览

public static void Main(string[] args)
        {
            
            using (var db=Db.CreateDefaultDb()) {
                db.TransactionEnabled=true;
                db.DebugEnabled=true;
                Console.WriteLine("---------------嵌套查询---------------------");
                var qiantao=ScoreSet.SelectAll().Where(
                    ScoreSet.UserID.In(UserSet.Select(UserSet.UserID).Where(
                        UserSet.ClassID.In(
                        ClassSet.Select(ClassSet.ClassID).Where(
                                ClassSet.ClassName.Equal(c.ClassName).And(ClassSet.ClassID.BiggerThan(0))
                            )
                        )
                    )
                  ) 
                ).Top(1);
                
                Console.WriteLine("---------------分组查询---------------------");
                var mql=ScoreSet.Select(ScoreSet.ScoreM.Sum().AS("sum"),ScoreSet.TypeName).Where(ScoreSet.ScoreM.BiggerThanOrEqual(100)).GroupBy(ScoreSet.TypeName).Having(ScoreSet.ScoreM.Sum().BiggerThan(300));
               
                Console.WriteLine("---------------连接查询---------------------");
                var m1=ClassSet.Select(ClassSet.ClassID,ClassSet.ClassName)
                    .LeftJoin(
                    UserSet.Select(UserSet.UserID))
                    .ON(ClassSet.ClassID.Equal(UserSet.UserID))
                    .Where(UserSet.UserID.BiggerThan(9));

            }
            Console.WriteLine("---------------Union测试---------------------");
            using (var db=Db.CreateDefaultDb()) {
                db.TransactionEnabled=true;
                db.DebugEnabled=true;
                
                var mql=ClassSet.SelectAll().Where(ClassSet.ClassID.BiggerThan(1))
                    .Union(ClassSet.SelectAll().Where(ClassSet.ClassID.BiggerThan(2)));  

            }
        }

 

 

3)使用DataSet 

1.使用存储过程

DataSet dataset=db.ExecuteProToDataSet("存储过程名",参数一,参数二);

2.使用sql

DataSet dataset=db.ExecuteSqlToDataSet(sql,"boy");

3.使用mql

DataSet dataset=db.GetDataSet(ClassSet.SelectAll().Where(ClassSet.ClassID.BiggerThan(0)));

 

4)使用xml配置sql查询

1.配置config节点

 

<appSettings>
    <add key="SQL_XML_FILE_NAME" value="C:\Moon\Moon.Orm\sql.xml"></add>//如果不是全路径,则默认在dll生成目录
</appSettings>

 

2.配置xml(sql.xml)

 

<?xml version="1.0"?>
<sqls>
    <sqlxml id="getname">
        <sql>select name from user where id>@</Sql>
        <description>查询用户名(描述信息)</Description>
    </sqlxml>
</sqls>
 3.使用id进行查询
var list=db.GetDictionaryList(XmlHelper.GetSqlXmlByID("getname"),"boy");

5)sql之王者归来

使用GetDynamicList ,让你体验另一种自由

 

object,但在.net 4.0下面,您可以用dynamic直接取值.
string sql22="select * from Score";
dynamic list22=db.GetDynamicList(sql22,"Score");
foreach(var a in list22){
       Console.WriteLine(a.ID+"--"+a.ScoreM+"--"+a.UserID+"--"+a.TypeName);//都是强类型
}

以下是体验强类型:) 

 
 

 

 

 

 

 

 

 

 

 

 -----------------------------------------------------------------

二、明月语言专家介绍

软件名:明月语言专家
软件特色:
1)本软件提供几十个国语言翻译功能,
2)鼠标选中文字(如在网页中选中),然后按下CapsLock键就可以翻译;
3)软件提供多引擎,同时组合了最优的翻译引擎;
4)同时提供离线单词翻译功能;

5)提供文章、小说等朗读功能

    鼠标选中文字(如在网页中选中),然后连续按两下shift键就可以朗读

,会帮你朗读哦

软件截图

三、下载语言专家

下载地址:

http://lko2o.com/dic/%E6%98%8E%E6%9C%88%E8%AF%AD%E8%A8%80%E4%B8%93%E5%AE%B6.exe

XP用户如果不能运行,请下载一下补丁安装后就可以运行

http://11.gddx1.crsky.com/200610/Microsoft_DotNetFXCHS2.0.exe

 

 

 

 

posted @ 2014-02-03 16:31  [秦时明月]  阅读(3716)  评论(18编辑  收藏  举报