小编Jos*_*orp的帖子

Unity IOC Builddup vs Resolve?

当我使用Unity IOC时,我想知道何时使用builddup以及何时使用resolve.

我什么时候打电话拆机?

谢谢

.net ioc-container unity-container

19
推荐指数
1
解决办法
7214
查看次数

new()在`where T:new()?中做了什么

new()在下面的代码中做了什么?

public class A<T> where T : B, new()
Run Code Online (Sandbox Code Playgroud)

.net c# generics

14
推荐指数
1
解决办法
3590
查看次数

GWT和.NET

如何将GWT与Visual Studio一起使用来创建ASP.NET网站?如果有可能.

谢谢

c# asp.net gwt asp.net-ajax asp.net-3.5

9
推荐指数
2
解决办法
1万
查看次数

任何人都可以为我简化这个算法吗?

基本上我只是想检查一个时间段是否与另一个时间段重叠.空结束日期表示无穷大.任何人都可以为我缩短这个,因为它很难阅读.干杯

    public class TimePeriod
    {
        public DateTime StartDate { get; set; }
        public DateTime? EndDate { get; set; }

        public bool Overlaps(TimePeriod other)
        {
            // Means it overlaps
            if (other.StartDate == this.StartDate
                || other.EndDate == this.StartDate
                || other.StartDate == this.EndDate
                || other.EndDate == this.EndDate)
                return true;

            if(this.StartDate > other.StartDate)
            {
                // Negative
                if (this.EndDate.HasValue)
                {
                    if (this.EndDate.Value < other.StartDate)
                        return true;
                    if (other.EndDate.HasValue && this.EndDate.Value < other.EndDate.Value)
                        return true;
                }

                // Negative
                if (other.EndDate.HasValue)
                {
                    if (other.EndDate.Value > this.StartDate)
                        return …
Run Code Online (Sandbox Code Playgroud)

.net c# algorithm

9
推荐指数
2
解决办法
587
查看次数

ASP.NET中的动态表单生成

我想从ASP.NET中的数据库动态生成表单,最好的方法是什么?我可以使用任何内置功能吗?

我将有数据库表来表示面板及其名称,然后对于每个面板,它包含不同的字段及其类型(组合,文本框等等).

请指教,谢谢.

注意:我必须使用Telerik Ajax控件来生成表单

html c# asp.net dynamic-data

8
推荐指数
1
解决办法
2万
查看次数

多个聚合每个事务的根INSTANCES

在DDD中,Aggregate应代表事务边界.需要涉及多个聚合的交易通常表明应该改进模型,或者应该审查交易要求,或者两者兼而有之.

这是指每个聚合根INSTANCE还是每个聚合的事务边界?

假设我有一个名为"Node"的聚合根,在每个"Node"中我都有一个"Fields(Value objects)"的集合.每个"Field"都是Type,可以是Type"Node".在我的情况下,如果它是类型"节点",我将Id存储到"节点"聚合根.

Node (AggregateRootID 1)
---> Field1 : String (John)
---> Field2 : String (Doe)
---> Field3 : Node (AggregateRootID 2)

Node (AggregateRootID 2)
--> Field1 : String (Jane)
--> Field2 : String (Doe)
Run Code Online (Sandbox Code Playgroud)

如果我有一个更新两个AggregateRoots实例的事务,那有效吗?

或者它是否意味着如果我有"节点"聚合和"元素"聚合,我不能在一个事务中更新它们?

domain-driven-design transactions aggregate aggregateroot cqrs

7
推荐指数
1
解决办法
1339
查看次数

在Winforms中绘制一条线

我在以简单的窗体形式在组框中绘制线条时遇到问题.

这是我的代码:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();                        
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);            
            DrawLShapeLine(groupBox1.CreateGraphics(), 10, 10, 20, 40);
        }

        public void DrawLShapeLine(System.Drawing.Graphics g, int intMarginLeft, int intMarginTop, int intWidth, int intHeight)
        {
            Pen myPen = new Pen(Color.Black);
            myPen.Width = 2;
            // Create array of points that define lines to draw.
            int marginleft = intMarginLeft;
            int marginTop = intMarginTop;
            int width = intWidth;
            int height = intHeight;
            int arrowSize = 3;
            Point[] points …
Run Code Online (Sandbox Code Playgroud)

.net c# system.drawing winforms

6
推荐指数
2
解决办法
4万
查看次数

如何创建Android Google Plus App等按钮

我是Android开发的新手,我想知道是否有任何样本可用于创建类似于Android上google + app底部的photo/checkin/mood/write面板的面板.

1)它们是4个按钮吗?如何设置按钮的样式?

2)我想在向下滚动时自动隐藏面板,但在向上滚动时显示.

感谢是否有人可以指导我正确的方向.

干杯

Android Google Plus应用

java android android-layout android-button

6
推荐指数
1
解决办法
2733
查看次数

在C#中扩展枚举

我想知道我是否可以在C#中扩展Enum类型以实现我的自定义Enum.GetValues(类型)并将其称为Enum.GetMyCustomValues(type)

我试图实现这样的事情:

public static bool IsFlagSet<T>(this T value, T flag) where T : Enum
{
    return (value & flag) != (T)0;
}
Run Code Online (Sandbox Code Playgroud)

但它无法完成......我可以做任何工作吗?干杯

.net c# extension-methods enums

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

如何使用Restful API提交深层嵌套资源(HATEOAS)

假设我有一个包含联系详细信息资源的应用程序资源,联系人详细信息包含地址资源.

例如.

Application
--> Name
--> Application Amount
--> Application Contacts 
--> --> Contact 1
--> --> --> Address
--> --> Contact 2
--> --> --> Address
Run Code Online (Sandbox Code Playgroud)

在对应用程序执行POST时,我正在创建根应用程序.对于所有子资源,如应用程序联系人,我做一个POST来创建联系人1等...

我的问题是,Application =提交某个地方进行处理,但我不想在填写所有内容之前提交它,也就是所有子资源.

So the order of submission
1) Create Application Resource --> POST /Application --> Get ID
2) Create Contact 1 Resource --> POST /Application/id/Contacts --> Get ID
3) Create Contact 1 Address Resource --> POST /Application/id/Contacts/id/Addresses
4) Create Contact 2 Resource --> POST /Application/id/Contacts --> Get ID 
5) Create Contact 2 …
Run Code Online (Sandbox Code Playgroud)

c# api rest web-services hateoas

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