标签: .net-core

如何在.net Core 2中的活动目录上获取用户/组列表

正在处理一个项目,其中所有用户都在域下的活动目录中创建。

我想要的是获取域中的所有用户,这可能吗?

我对使用.net core2.0的活动目录是陌生的。

任何建议和指导表示赞赏。

active-directory .net-core asp.net-core

0
推荐指数
1
解决办法
3897
查看次数

此平台不支持Apache Ignite .NET序列化委托

这里提出关于安排工作的问题.

通过简单的文本输出到控制台测试它,并通过HttpClient通过简单的异步Web请求进行测试.工作良好.

实现了具有大量长时间运行任务和并行计算的实际业务逻辑.

Ignite .NET版本:2.3.0

应用平台:dotnet core 2.0

但是在服务注册时收到例外DeployClusterSingleton.

System.Runtime.Serialization.SerializationException:此平台不支持"序列化委托".

来源:System.Private.CoreLib

   at System.MulticastDelegate.GetObjectData(SerializationInfo info, StreamingContext context)
   at Apache.Ignite.Core.Impl.Binary.SerializableSerializer.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryUtils.WriteArray(Array val, BinaryWriter ctx, Nullable`1 elemTypeId)
   at Apache.Ignite.Core.Impl.Binary.BinarySystemHandlers.WriteArray(BinaryWriter ctx, Object obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer) …
Run Code Online (Sandbox Code Playgroud)

.net-core ignite

0
推荐指数
1
解决办法
373
查看次数

AddTransient:有区别吗?

与IServiceCollection.AddTransient方法相关的问题.

下面两行代码基本上做同样的事情吗?他们不一样吗?使用另一个经文是否有优势?

services.AddTransient<MyService,MyService>();
services.AddTransient<MyService>();
Run Code Online (Sandbox Code Playgroud)

我最初的代码设置在第一行,一切正常.但后来我正在调查另一个问题,我看到了第二行的例子.所以,我出于好奇而改变了我的代码,一切仍然有效.

只是好奇.

c# dependency-injection .net-core

0
推荐指数
1
解决办法
326
查看次数

EF Core中缺少Update-Database命令

  • 下载的.NET Core模板v3.4.0
  • 从VS2017软件包管理器控制台,我尝试自动完成Update-Database命令,但此命令不存在!

https://imgur.com/a/MqA0a

entity-framework ef-migrations entity-framework-core .net-core aspnetboilerplate

0
推荐指数
2
解决办法
1909
查看次数

EF Core 2.0包含具有动态查询的嵌套实体

我正在使用System.Linq.Dynamic.Core;以下扩展方法通过名称动态访问DbSet并从字符串生成查询。

这是淘汰方法:

namespace Microsoft.EntityFrameworkCore
{
    public static partial class CustomExtensions
    {
        public static IQueryable Query(this DbContext context, string entityName) =>
            context.Query(context.Model.FindEntityType(entityName).ClrType);

        public static IQueryable Query(this DbContext context, Type entityType) =>
            (IQueryable)((IDbSetCache)context).GetOrAddSet(context.GetDependencies().SetSource, entityType);
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我访问DbSet的方式:

IQueryable<T> dbSet = (IQueryable<T>)_db.Query(entityName);
Run Code Online (Sandbox Code Playgroud)

这可以正常工作,我可以构建查询,然后创建列表,但是没有嵌套实体加载。似乎IQueryable没有的定义Include()。如果我以常规方式直接访问数据库上下文,但未使用此动态方法,则可以看到包含方法。

如何使用动态方法包括嵌套实体?

c# entity-framework-core .net-core

0
推荐指数
2
解决办法
2244
查看次数

强制调用正确的方法重载

我有两种方法,具有以下签名:

public void DoSomething<T>(T value) { ... }

public void DoSomething<T>(IEnumerable<T> value) { ... }
Run Code Online (Sandbox Code Playgroud)

我试着像这样打电话给第二个:

DoSomething(new[] { "Pizza", "Chicken", "Cheese" });
Run Code Online (Sandbox Code Playgroud)

它仍然跳进了第一个.如何强制它将进入第二种方法呢?例如,通过对通用参数使用where子句?

编辑:

更确切地说:为什么它不起作用,即使我更具体并将重载更改为类似的东西,这将在尝试调用上面显示的方法时导致编译错误:

public void DoSomething<T>(T value) where T : IComparable { ... }

public void DoSomething<T>(IEnumerable<T> value) where T : IComparable { ... }
Run Code Online (Sandbox Code Playgroud)

.net c# generics overloading .net-core

0
推荐指数
2
解决办法
85
查看次数

有没有办法简化字段初始化?

所以我想知道我是否可以以某种方式简化它,因为它在屏幕上占用了大量空间:

private Dictionary<string, Dictionary<string, List<double>>> storage = new Dictionary<string, Dictionary<string, List<double>>>();
Run Code Online (Sandbox Code Playgroud)

.net c# .net-core

0
推荐指数
1
解决办法
86
查看次数

为什么我的自定义数据类型在C#中继续转换为KeyValuePair?

我有这种数据类型:

Dictionary<string, List<Dictionary<string, List<Dictionary<string, List<Dictionary<string, string>>>>>>>
Run Code Online (Sandbox Code Playgroud)

每当我试图到达它的最底部来计算一些东西时,我就会遇到一个错误,我无法在KeyValuePairs上使用foreach:

foreach statement cannot operate on variables of type 'KeyValuePair<string, List<Dictionary<string, List<Dictionary<string, string>>>>>' because 'KeyValuePair<string, List<Dictionary<string, List<Dictionary<string, string>>>>>' does not contain a public definition for 'GetEnumerator' [RestService]
Run Code Online (Sandbox Code Playgroud)

这是循环的一部分:

void GetMetricsCount(List<Dictionary<string, List<Dictionary<string, List<Dictionary<string, string>>>>>> device, Dictionary<string, string> results_holder)
        {
            // count all metrics
            foreach (var type_element in device)
            {   
                foreach (var group_element in type_element)
                {   
                    foreach (var wtf in group_element)
Run Code Online (Sandbox Code Playgroud)

现在真的很好,如果有更好的方法来处理C#中那种复杂的数据结构,我真的很感激,如果有人告诉我怎么样,因为这很糟糕!

更新:我很抱歉,但我在这里复制了一些代码.以下是对非匹配类型的挫折的答案:

        // Get overview of metrics for last 24h
    public Dictionary<string, Dictionary<string, …
Run Code Online (Sandbox Code Playgroud)

.net c# .net-core

0
推荐指数
1
解决办法
334
查看次数

在AspNetUsers中存储其他用户属性

将属性扩展/添加到AspNetUsers表中的最佳做法是什么?(.Net Core 2.0)

1)您可以在AspNetUsers表中添加其他属性

2)您可以将内容放入声明中

3)您可以在属性中放置对另一个表的引用

4)您可以使用user.id并将其与更多数据一起存储在另一个表中

那么最佳实践是什么?

.net asp.net-mvc asp.net-identity .net-core asp.net-core-2.0

0
推荐指数
1
解决办法
67
查看次数

什么是开发.Net Core应用程序的IDE?

我想学习.net核心应用程序开发。我目前正在使用Visual Studio 2012

是否可以使用Visual Studio 2012开发.net核心应用程序,还是必须使用Visual Studio 2017.net核心开发?

.net visual-studio visual-studio-2012 .net-core

0
推荐指数
1
解决办法
4259
查看次数