小编Jam*_*ran的帖子

ILMerge最佳实践

你使用ILMerge吗?您是否使用ILMerge合并多个程序集以简化dll的部署?ILMerging组装后,您是否在生产中发现了部署/版本控制问题?

我正在寻找一些关于使用ILMerge来减少部署摩擦的建议,如果可能的话.

.net c# deployment ilmerge

71
推荐指数
4
解决办法
5万
查看次数

实体框架4.1 DbContext覆盖SaveChanges以审核属性更改

我正在尝试将属性更改的约束"审计日志"实现为一组类中的属性.我已成功找到如何设置CreatedOn | ModifiedOn类型属性,但未能找到如何"找到"已修改的属性.

例:

public class TestContext : DbContext
{
    public override int SaveChanges()
    {
        var utcNowAuditDate = DateTime.UtcNow;
        var changeSet = ChangeTracker.Entries<IAuditable>();
        if (changeSet != null)
            foreach (DbEntityEntry<IAuditable> dbEntityEntry in changeSet)
            {

                switch (dbEntityEntry.State)
                {
                    case EntityState.Added:
                        dbEntityEntry.Entity.CreatedOn = utcNowAuditDate;
                        dbEntityEntry.Entity.ModifiedOn = utcNowAuditDate;
                        break;
                    case EntityState.Modified:
                        dbEntityEntry.Entity.ModifiedOn = utcNowAuditDate;
                        //some way to access the name and value of property that changed here
                        var changedThing = SomeMethodHere(dbEntityEntry);
                        Log.WriteAudit("Entry: {0} Origianl :{1} New: {2}", changedThing.Name,
                                        changedThing.OrigianlValue, changedThing.NewValue)
                        break;
                }
            }
        return …
Run Code Online (Sandbox Code Playgroud)

entity-framework

39
推荐指数
2
解决办法
3万
查看次数

PowerShell DSC复合资源

我已成功创建DSC配置并将其部署到服务器上.作为下一步,我尝试将服务器中常见的配置块部分拆分为可重用部分,或者用DSC说法"复合资源".经过大量的研究后,我仍然无法使用复合资源,在运行"Get-DSCResource"时没有列出它们.

在查看了"Get-DSCResource"函数之后,它似乎需要一个'DSCResources'子文件夹,PowerShell.org电子书没有说明,但PowerShell博客却说明了这一点.Get-DSCResources函数使用资源名称调用Get-Module(示例中为SimpleConfig).当根文件夹中没有psd1时(例子中的BaseConfiguration),两者都没有考虑Get-Module没有"看到"子文件夹.我调整了这些方法,得到了下面的例子,但是也没有成功.

我看过:

示例配置:

# $env:ProgramFiles\WindowsPowerShell\BaseConfiguration\BaseConfiguration.psd1
@{
    ModuleVersion = '1.0'
    GUID = '84f449fd-8f26-4bb9-908f-eb675c56b5d8'
    Author = 'James Pogran'
}

# $env:ProgramFiles\WindowsPowerShell\BaseConfiguration\DSCResoures\SimpleConfig\SimpleConfig.schema.psm1
Configuration SimpleConfig
{
    Log LogThis
    {
        Message = "Foo"
    }
}

# $env:ProgramFiles\WindowsPowerShell\BaseConfiguration\DSCResoures\SimpleConfig\SimpleConfig.psd1
RootModule = "SimpleConfig.schema.psm1"
Run Code Online (Sandbox Code Playgroud)

powershell

5
推荐指数
1
解决办法
2445
查看次数

标签 统计

.net ×1

c# ×1

deployment ×1

entity-framework ×1

ilmerge ×1

powershell ×1