четверг, 28 января 2016 г.
четверг, 14 января 2016 г.
EntityFranework Connection Management
https://msdn.microsoft.com/en-us/library/bb896325(v=vs.100).aspx
https://msdn.microsoft.com/en-us/data/dn456849.aspx
http://stackoverflow.com/questions/5285877/closing-connections-explicitly-in-entity-framework
http://stackoverflow.com/questions/19847248/entity-framework-v6-closes-connections-after-exception-without-using-statment
http://stackoverflow.com/questions/1282675/when-does-entity-framework-open-and-close-database-connections
вторник, 12 января 2016 г.
Web.config and App.config
App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Users;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="FortsTicks01" connectionString="Data Source=.\MSSQL12;Initial Catalog=FortsTicks01;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Web.config:
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Users;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="TimeSeries01" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TimeSeries01;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Users;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="FortsTicks01" connectionString="Data Source=.\MSSQL12;Initial Catalog=FortsTicks01;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Web.config:
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Users;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="TimeSeries01" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TimeSeries01;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
среда, 6 января 2016 г.
double compare
http://stackoverflow.com/questions/356807/java-double-comparison-epsilon
http://stackoverflow.com/questions/4787125/evaluate-if-two-doubles-are-equal-based-on-a-given-precision-not-within-a-certa
https://msdn.microsoft.com/ru-ru/library/9cczk1sc(v=vs.110).aspx
https://msdn.microsoft.com/ru-ru/library/ya2zha7s(v=vs.110).aspx
вторник, 5 января 2016 г.
SQL DateTime Types
https://msdn.microsoft.com/en-us/library/ff848733.aspx
https://msdn.microsoft.com/en-us/library/ms187819.aspx
https://msdn.microsoft.com/en-us/library/bb677335.aspx
https://msdn.microsoft.com/en-us/library/bb630289.aspx
https://msdn.microsoft.com/en-us/library/ms182418.aspx
https://msdn.microsoft.com/en-us/library/bb630352.aspx
суббота, 2 января 2016 г.
ArrayOfString to Byte Array
http://stackoverflow.com/questions/472906/converting-a-string-to-byte-array-without-using-an-encoding-byte-by-byte
http://stackoverflow.com/questions/14669820/how-to-convert-a-string-array-to-a-byte-array-java
Compress/Decompress
http://www.dotnetperls.com/compress
http://www.dotnetperls.com/decompress
{
BinaryFormatter bf = new BinaryFormatter();
byte[] bytes;
MemoryStream ms = new MemoryStream();
var lst = bs.Select(b => b.ToStr()).ToList();
bf.Serialize(ms, lst);
ms.Seek(0, 0);
var bts = ms.ToArray();
return bts;
}
private IEnumerable<IBarSimple> DeSerialize(byte[] bytes)
{
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
ms.Write(bytes, 0, bytes.Length);
ms.Seek(0, 0);
var ss = (List<string>)bf.Deserialize(ms);
var bs = ss.Select(s => s.ToBarDto()).ToList();
return bs;
}
private byte[] Compress(byte[] bytes)
{
using (MemoryStream ms = new MemoryStream())
{
using (GZipStream gzip = new GZipStream(ms, CompressionMode.Compress, true))
{
gzip.Write(bytes, 0, bytes.Length);
}
return ms.ToArray();
}
}
private byte[] DeCompress(byte[] bytes)
{
using (GZipStream gzstream = new GZipStream(new MemoryStream(bytes), CompressionMode.Decompress))
{
const int size = 4096;
byte[] buffer = new byte[size];
using (MemoryStream mstr = new MemoryStream())
{
int count = 0;
do
{
count = gzstream.Read(buffer, 0, size);
if (count > 0)
{
mstr.Write(buffer, 0, count);
}
} while (count > 0);
return mstr.ToArray();
}
}
}
Подписаться на:
Сообщения (Atom)