小编pix*_*pix的帖子

在VS 2010 .net 4.0中使用实体框架时出现'datetime2'错误

得到此错误:

System.Data.SqlClient.SqlException:将datetime2数据类型转换为日期时间数据类型会导致超出范围的值.

我的实体对象全部排列到DB对象.

我通过Google发现只有一个引用此错误:

谷歌的结果

阅读本文之后,我记得我们确实添加了2个字段,然后从VS 2010更新了实体模型.我不确定他的意思是"手工编码"差异.我没有看到任何.

我在代码中所做的就是填充实体对象,然后保存.(我还在代码中填充新字段)我用DateTime.Now... 填充了日期字段

代码的重要部分是: ctx.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);

该数据库是SQL Server 2008.

思考?

其余的错误:

在System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager,IEntityAdapter适配器)在System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)在System.Data.Objects.ObjectContext.SaveChanges(SaveOptions选项)在SafariAdmin.Site.WebServices.SpeciesPost.SaveOrUpdateSpecies(字符串SID,字符串fieldName的,字符串的authToken)在SpeciesPost.svc.cs:管线58在SafariAdmin.TestHarness.Tests.Site.WebServices.SpeciesPostSVC_Tester.SaveNewSpecies()在SpeciesPostSVC_Tester.cs:线33 --SqlException在System.Data.SqlClient.SqlConnection.OnError(SqlException异常,布尔breakConnection)在System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection)在System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()在System.Data.在System.Data的System.Data.SqlClient.SqlDataReader.get_MetaData()处的System.Data.SqlClient.SqlDataReader.ConsumeMetaData()处的SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj). System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior)上的System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async)中的SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,String resetOptionsString) cmdBehavior,runBehavior runBehavior,布尔returnStream,字符串方法,DbAsyncResult结果)在System.Data.SqlClient.SqlCommand.RunExecuteReader(的CommandBehavior cmdBehavior,runBehavior runBehavior,布尔returnStream,在System.Data.SqlClient.SqlCommand.ExecuteReader(的CommandBehavior行为,串法)在System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(的CommandBehavior行为)在System.Data.Common.DbCommand.ExecuteReader(的CommandBehavior行为)在系统串法) .Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator,EntityConnection connection,Dictionary2 identifierValues, ListSystem.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager,IEntityAdapter adapter)中的1 generatedValues)

c# sql-server entity-framework sql-server-2008

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

无法从资产'index.android.bundle'加载脚本.确保捆绑包正确打包或者您正在运行打包服务器

我正在使用版本为0.38.0的React Native应用程序,当我尝试将其升级到0.45.1时,它显示以下错误

java.lang.RuntimeException: Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
at com.facebook.react.cxxbridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:198)
at com.facebook.react.cxxbridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:216)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:994)
at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:746)
at java.lang.Thread.run(Thread.java:761)
Run Code Online (Sandbox Code Playgroud)

我尝试过以下解决方案,但它对我不起作用

SO:无法从资源上加载脚本index.android.bundle在Windows上
SO:反应原生android无法加载JS包

android reactjs react-native

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

通过Cloudformation将角色添加到AWS Cognito Identity Pool

我正在尝试编写CloudFormation模板,以使用Google身份验证和使用预先存在的角色创建新的Cognito身份池.

此代码使用Google身份验证创建新的标识池 -

Resources:
 cognitoid:
  Type: "AWS::Cognito::IdentityPool"
  Properties:
   "AllowUnauthenticatedIdentities": false
   "SupportedLoginProviders": { "accounts.google.com": "<Google client id>" }
Run Code Online (Sandbox Code Playgroud)

对于角色,AWS::Cognito::IdentityPool在附加角色的属性中没有任何内容.

amazon-web-services aws-cloudformation

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

JenkinsFile默认工作区名称太长

我目前正在用bitbucket设置jenkins.我创建了一个新的jenkins项目作为multibranch项目.

JenkinsFile托管在git存储库中.如何强制jenkins生成比默认名称更短的分支名称.

E:\jenkins\workspace\reposName-BrancheName-ZKIZ7BNGL6RTDKLQAQ7QR4FKZMOB3DDAVZ564BLWT2BY5ZV652VA
Run Code Online (Sandbox Code Playgroud)

我怎么能骑车 ZKIZ7BNGL6RTDKLQAQ7QR4FKZMOB3DDAVZ564BLWT2BY5ZV652VA

这是我的jenkinsFile

#!/usr/bin/env groovy
env.PATH = env.PATH + ";c:\\Windows\\System32"
def call(String label = null, Closure body) {
    node(label) {
        String path = pwd()
        String branchName = env.BRANCH_NAME
        if (branchName) {
            path = path.split(Pattern.quote(File.separator))
            def workspaceRoot = path[0..<-1].join(File.separator)
            def currentWs = path[-1]
            String newWorkspace = env.JOB_NAME.replace('/', '-')
            newWorkspace = newWorkspace.replace(File.separator, '-')
            newWorkspace = newWorkspace.replace('%2f', '-')
            newWorkspace = newWorkspace.replace('%2F', '-')
            if (currentWs =~ '@') {
                newWorkspace = "${newWorkspace}@${currentWs.split('@')[-1]}"
            }
            path = "${workspaceRoot}${File.separator}${newWorkspace}"
        }
        ws(path) {
            body()
        }
    } …
Run Code Online (Sandbox Code Playgroud)

jenkins-pipeline multibranch-pipeline

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

WPF RelativeSource行为

我在理解RelativeSource绑定行为方面遇到了一些问题.下面是将Label内容StackPanel正确绑定到Tag的代码:

<Window x:Class="Binding_RelativeSource.MainWindow" Tag="Window Tag">
    <Grid Tag="Grid Tag">
        <StackPanel Tag="StackPanel Tag" Height="100" HorizontalAlignment="Left" Margin="156,97,0,0" Name="stackPanel1" VerticalAlignment="Top" Width="200">
            <Label Content="{Binding Path=Tag,RelativeSource={RelativeSource Mode=FindAncestor,AncestorLevel=1,AncestorType=StackPanel},FallbackValue=BindingFailed}" Height="28" Name="label1" />
        </StackPanel>
    </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

上面的代码不绑定GridTag,如果我改变AncestorType=GridAncestorLevel=2.我有两个问题:

  1. 我想我应该将AncestorLevel改为2,绑定到Grid.但它起作用了AncestorLevel=1.为什么?

  2. 我也无法将标签绑定到Window标签.请提示.

data-binding wpf binding

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

如何在CompositeWPF/Silverlight中删除区域中的所有视图

我想在Composite中删除我所在区域的所有视图.我正在使用Silverlight 4.0.

不幸的是,此代码在Composite内部与OutOfRangeException崩溃.

        List<object> views = new List<object>(_regionManager.Regions["NavigationRegion"].Views);

        foreach (object view in views)
        {
            _regionManager.Regions["NavigationRegion"].Remove(view);
        }
Run Code Online (Sandbox Code Playgroud)

这是我的callstack:

[外部代码]
Microsoft.Practices.Composite.Presentation!Microsoft.Practices.Composite.Presentation.Regions.ViewsCollection.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs E = {System.Collections.Specialized.NotifyCollectionChangedEventArgs})线102个+ 0X24字节C#
Microsoft.Practices.Composite.Presentation!Microsoft.Practices.Composite.Presentation.Regions.ViewsCollection.RemoveAndNotify(System.Collections.IList items = Count = 1)第45行+ 0x2b字节C#
Microsoft.Practices.Composite.Presentation!Microsoft. Practices.Composite.Presentation.Regions.ViewsCollection.UnderlyingCollection_CollectionChanged(对象发件人=计数= 0,System.Collections.Specialized.NotifyCollectionChangedEventArgs E = {System.Collections.Specialized.NotifyCollectionChangedEventArgs})线153 + 0XB字节C#[外部代码]
微软. Practices.Composite.Presentation!Microsoft.Practices.Composite.Presentation.Regions.Region.Remove(object view = {Kite.MyApp.SlUI.Navigation Region.NavigationRegionView})线230 + 0x1b字节C#
MyApp.SlUI!Kite.MyApp.SlUI.Components.ViewController.linksRegion_LanguageChanged(对象发件人= {Kite.MyApp.SlUI.Controls.LinksUserControl},Kite.MyApp.SlUI.Common. EventArgs e = {Kite.MyApp.SlUI.Common.EventArgs})第77行+ 0x2d字节C#
MyApp.SlUI!Kite.MyApp.SlUI.Controls.LinksUserControl.OnLanguageChanged(string newLanguage ="en-GB")第37行+ 0x32字节C#
MyApp.SlUI!Kite.MyApp.SlUI.Controls.LinksUserControl.ComboBox_SelectionChanged(对象发件人= {System.Windows.Controls.ComboBox},System.Windows.Controls.SelectionChangedEventArgs E = {System.Windows.Controls.SelectionChangedEventArgs})第31行+ 0xb字节C#[外部代码]

我错了什么?

PS在我所在的地区,我有3个观点.因此,复合体在删除第三个时崩溃了.

希望你帮忙:).谢谢.

UPD:我下载了调试符号,发现问题仅在Accordion控件中作为区域.这是完整的调用堆栈:

mscorlib.dll!System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument argument, System.ExceptionResource resource) + 0x41 bytes 
mscorlib.dll!System.ThrowHelper.ThrowArgumentOutOfRangeException() + 0x10 bytes 
mscorlib.dll!System.Collections.Generic.List<object>.this[int].get(int index …
Run Code Online (Sandbox Code Playgroud)

silverlight wpf prism

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

如何使 WPF 标签可选择?

我只想从 UI 窗口复制标签内容。任何人都可以帮忙如何制作吗?

data-binding wpf label wpf-controls

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

c#无法在字符串中插入换行符

我在下面的短信中插入换行符时遇到问题。目前我正在使用 Environment.NewLine 但这似乎不起作用。这是它的显示方式。

在此处输入图片说明

代码

  error =
                            @"You cannot split a sale@
                              <ul>
                                <li>With yourself.</li>            
                                <li>A representative that has not completed their IBA and not been approved by compliance.</li>
                                <li>A terminated representative.</li>
                                </ul>".Replace("@", Environment.NewLine)
Run Code Online (Sandbox Code Playgroud)

我基本上想像这样展示它

You cannot split a sale

•   With yourself.            
•   A representative that has not completed their IBA and not been approved by compliance.
•   A terminated representative.
Run Code Online (Sandbox Code Playgroud)

编辑

html

<div class="row">
      <div class="col-12 col-lg-6">
        <div *ngIf="infoMessage" class="notification warning">
          <fa-icon [icon]="['fas', 'info-circle']"></fa-icon>
          <span [innerHTML]="infoMessage"></span>
        </div>    
      </div>
    </div> …
Run Code Online (Sandbox Code Playgroud)

html c#

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