克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Note

[TOC]

Apollo

.NET Core appsetting.json 配置信息

"AppId": "Test.Apollo2", 
"MetaServer": "http://192.168.1.128:8080,http://192.168.1.120:8080"
"Env":Local = 0,Dev = 1,Fws = 2,Fat = 3,Uat = 4,Lpt = 5,Pro = 6,Tools = 7
"Timeout":5000 //默认

Docker

常用命令

安装docker-machine

base=https://github.com/docker/machine/releases/download/v0.16.0 &&
  curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
  sudo install /tmp/docker-machine /usr/local/bin/docker-machine

创建容器

  • docker-machine create 自定义容器名 查看容器
  • docker-machine ls
    进入容器
  • docker-machine ssh 容器名称
  • docker-machine stop/rm 停止/删除

Dapper

插入操作:将一个对象插入到数据库中,代码如下:

 /// <summary>
/// 测试插入单条数据
/// </summary>
static void test_insert()
{
    var content = new Content
    {
        title = "标题1",
        content = "内容1",

    };
    using (var conn = new SqlConnection("Data Source=127.0.0.1;User ID=sa;Password=1;Initial Catalog=Czar.Cms;Pooling=true;Max Pool Size=100;"))
    {
        string sql_insert = @"INSERT INTO [Content]
        (title, [content], status, add_time, modify_time)
        VALUES   (@title,@content,@status,@add_time,@modify_time)";
        var result = conn.Execute(sql_insert, content);
        Console.WriteLine($"test_insert:插入了{result}条数据!");
    }
}

一次批量插入多条数据,测试代码如下:

/// <summary>
/// 测试一次批量插入两条数据
/// </summary>
static void test_mult_insert()
{
    List<Content> contents = new List<Content>() {
        new Content
    {
        title = "批量插入标题1",
        content = "批量插入内容1",

    },
        new Content
    {
        title = "批量插入标题2",
        content = "批量插入内容2",

    },
};

    using (var conn = new SqlConnection("Data Source=127.0.0.1;User ID=sa;Password=1;Initial Catalog=Czar.Cms;Pooling=true;Max Pool Size=100;"))
    {
        string sql_insert = @"INSERT INTO [Content]
        (title, [content], status, add_time, modify_time)
        VALUES   (@title,@content,@status,@add_time,@modify_time)";
        var result = conn.Execute(sql_insert, contents);
        Console.WriteLine($"test_mult_insert:插入了{result}条数据!");
    }
}

删除一条数据,与一次删除多条数据吧,代码如下:

 /// <summary>
/// 测试删除单条数据
/// </summary>
static void test_del()
{
    var content = new Content
    {
        id = 2,

    };
    using (var conn = new SqlConnection("Data Source=127.0.0.1;User ID=sa;Password=1;Initial Catalog=Czar.Cms;Pooling=true;Max Pool Size=100;"))
    {
        string sql_insert = @"DELETE FROM [Content]
    WHERE   (id = @id)";
        var result = conn.Execute(sql_insert, content);
        Console.WriteLine($"test_del:删除了{result}条数据!");
    }
}

/// <summary>
/// 测试一次批量删除两条数据
/// </summary>
static void test_mult_del()
{
    List<Content> contents = new List<Content>() {
        new Content
    {
        id=3,

    },
        new Content
    {
        id=4,

    },
};

    using (var conn = new SqlConnection("Data Source=127.0.0.1;User ID=sa;Password=1;Initial Catalog=Czar.Cms;Pooling=true;Max Pool Size=100;"))
    {
        string sql_insert = @"DELETE FROM [Content]
        WHERE   (id = @id)";
        var result = conn.Execute(sql_insert, contents);
        Console.WriteLine($"test_mult_del:删除了{result}条数据!");
    }
}

修改一条数据,与一次批量修改多条数据

/// <summary>
/// 测试修改单条数据
/// </summary>
static void test_update()
{
    var content = new Content
    {
        id = 5,
        title = "标题5",
        content = "内容5",

    };
    using (var conn = new SqlConnection("Data Source=127.0.0.1;User ID=sa;Password=1;Initial Catalog=Czar.Cms;Pooling=true;Max Pool Size=100;"))
    {
        string sql_insert = @"UPDATE  [Content]
        SET         title = @title, [content] = @content, modify_time = GETDATE()
        WHERE   (id = @id)";
        var result = conn.Execute(sql_insert, content);
        Console.WriteLine($"test_update:修改了{result}条数据!");
    }
}

/// <summary>
/// 测试一次批量修改多条数据
/// </summary>
static void test_mult_update()
{
    List<Content> contents = new List<Content>() {
        new Content
    {
        id=6,
        title = "批量修改标题6",
        content = "批量修改内容6",

    },
        new Content
    {
        id =7,
        title = "批量修改标题7",
        content = "批量修改内容7",

    },
};

    using (var conn = new SqlConnection("Data Source=127.0.0.1;User ID=sa;Password=1;Initial Catalog=Czar.Cms;Pooling=true;Max Pool Size=100;"))
    {
        string sql_insert = @"UPDATE  [Content]
        SET         title = @title, [content] = @content, modify_time = GETDATE()
        WHERE   (id = @id)";
        var result = conn.Execute(sql_insert, contents);
        Console.WriteLine($"test_mult_update:修改了{result}条数据!");
    }
}

查询

/// <summary>
/// 查询单条指定的数据
/// </summary>
static void test_select_one()
{
    using (var conn = new SqlConnection("Data Source=127.0.0.1;User ID=sa;Password=1;Initial Catalog=Czar.Cms;Pooling=true;Max Pool Size=100;"))
    {
        string sql_insert = @"select * from [dbo].[content] where id=@id";
        var result = conn.QueryFirstOrDefault<Content>(sql_insert, new { id=5});
        Console.WriteLine($"test_select_one:查到的数据为:");
    }
}

/// <summary>
/// 查询多条指定的数据
/// </summary>
static void test_select_list()
{
    using (var conn = new SqlConnection("Data Source=127.0.0.1;User ID=sa;Password=1;Initial Catalog=Czar.Cms;Pooling=true;Max Pool Size=100;"))
    {
        string sql_insert = @"select * from [dbo].[content] where id in @ids";
        var result = conn.Query<Content>(sql_insert, new { ids=new int[] { 6,7} });
        Console.WriteLine($"test_select_one:查到的数据为:");
    }
}

关联查询

static void test_select_content_with_comment()
{
    using (var conn = new SqlConnection("Data Source=127.0.0.1;User ID=sa;Password=1;Initial Catalog=Czar.Cms;Pooling=true;Max Pool Size=100;"))
    {
        string sql_insert = @"select * from content where id=@id;
        select * from comment where content_id=@id;";
        using (var result = conn.QueryMultiple(sql_insert, new { id = 5 }))
        {
            var content = result.ReadFirstOrDefault<ContentWithComment>();
            content.comments = result.Read<Comment>();
            Console.WriteLine($"test_select_content_with_comment:内容5的评论数量{content.comments.Count()}");
        }

    }
}

Git 常用命令

git init :初始化本地仓库
git remote :查看关联的远程仓库连接
git remote add github github远程仓库地址 :创建一个远程仓库连接
git pull github master :从github命名的远程仓库拉取master分支内容
git checkout -b Sample02 :创建并切换到Sample02这个分支上
git branch :查看当前的所有分支
git add Sample02/ :把Sample02文件夹下面的所有修改文件添加到暂存区
git commit -m "注释" :把暂存区所有修改提交到本地仓库,并给本体提交写一个注释方便查看日志
git log --graph :查看修改日志
git push github Sample02 :把当前仓库中得当前分支的内容推送到github这个远程仓库的Sample02分支上,如果分支不存在则自动创建
git merge --no-ff -m "注释" Sample02 :在当前分支合并Sample02这个分支的修改到当前分支,并给这次合并添加注释

.NET Core

  • 启动流程 Program -> Main -> CreateWebHostBuilder -> UseStarup 加载 Starup 类,添加配置信息
  • service 是 ServiceCollection 类,如:AddSingleton() 依赖注入方法属于该类。
  • services.Configure(Configuration.GetSection("Content"));//注册TOption实例对象 配置映射
  • 加载自定义的json文件
WebHost.CreateDefaultBuilder(args)//使用默认的配置信息来初始化一个新的IWebHostBuilder实例
.ConfigureAppConfiguration((hostingContext, config) =>
{
    var env = hostingContext.HostingEnvironment;

    config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
            .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
            .AddJsonFile("Content.json",optional:false,reloadOnChange:false)
            .AddEnvironmentVariables();

})

Saas Paas lass

  • Saas:(在提供已经配置好的环境的云主机上同时提供了软件服务) Software-as-a-Service(软件即服务)提供给客户的服务是运营商运行在云计算基础设施上的应用程序,用户可以在各种设备上通过客户端界面访问,如浏览器。消费者不需要管理或控制任何云计算基础设施,包括网络、服务器、操作系统、存储等等;

  • PaaS:(提供了配置好环境的主机) Platform-as-a-Service(平台即服务)提供给消费者的服务是把客户采用提供的开发语言和工具(例如Java,python, .Net等)开发的或收购的应用程序部署到供应商的云计算基础设施上去。

  • laaS:(云主机) Infrastructure-as-a-Service(基础设施即服务)提供给消费者的服务是对所有计算基础设施的利用,包括处理CPU、内存、存储、网络和其它基本的计算资源,用户能够部署和运行任意软件,包括操作系统和应用程序。

MySQL

  • 2003 - cant connect ro mysql server on 10060 问题

开放端口 :https://blog.csdn.net/zhu_xun/article/details/16897035 sudo /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT /etc/my.cnf 加入 bind-address = 0.0.0.0

PMO

PMO可能不是亲自带项目, 而是指导项目经理的方法论,在项目流程的每个环节引导项目经理,正确干活的方法。所以PMO需要有更丰富的项目管理知识, 知其然并知其所以然,因为说服项目经理按照自己的思路去管理项目并不是很容易的事。 尤其和项目经理在某些方法套路不一致的时候。另外PMO一个很重要的职能是分析整体团队的工作效率是否有改善和提升空间,找出待改进点,提出改进建议, 不断提高团队的效率。以上纯粹个人见解, 每个公司各有不同。

The MIT License (MIT) Copyright (c) 2018 Mortal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化