Показаны сообщения с ярлыком EF. Показать все сообщения
Показаны сообщения с ярлыком EF. Показать все сообщения
воскресенье, 6 ноября 2016 г.
понедельник, 24 октября 2016 г.
sp_executesql
exec sp_executesql N'UPDATE [dbo].[Students] SET [StudentName] = @0 WHERE (([StudentId] = @1) AND ([StudentName] = @2)) ',N'@0 nvarchar(max) ,@1 int,@2 nvarchar(max) ',@0=N'Steve',@1=1,@2=N'Bill' go
exec sp_executesql
N'UPDATE [dbo].[Students]
SET [StudentName] = @0
WHERE (([StudentId] = @1) AND ([StudentName] = @2))',
N'@0 nvarchar(max) , @1 int, @2 nvarchar(max) ',
@0=N'Steve', @1=1, @2=N'Bill'
GO
четверг, 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 г.
воскресенье, 20 декабря 2015 г.
среда, 16 декабря 2015 г.
EF CodeFirst Init
In the CApp:
Database.SetInitializer(new InitDb());
var db = new EvlContext1();
var evl = new DbEventLog
{
Name = "GS.Trade.EventLog",
Alias = "GS.Trade.EventLog",
Code = "GS.Trade.EventLog",
Description = "GS.Trade.EventLog",
};
db.EventLogs.Add(evl);
db.SaveChanges();
In the Database Project
public class InitDb : DropCreateDatabaseIfModelChanges<ConfigurationContext>
{
protected override void Seed(ConfigurationContext db)
{
}
}
public class Initializer : DropCreateDatabaseIfModelChanges<EvlContext1>
{
protected override void Seed(EvlContext1 db)
{
Console.WriteLine("Initialize DataBase");
var evl = new DbEventLog
{
Name = "GS.Trade.EventLog",
Alias = "GS.Trade.EventLog",
Code = "GS.Trade.EventLog",
Description = "GS.Trade.EventLog",
};
db.EventLogs.Add(evl);
db.SaveChanges();
}
}
Database.SetInitializer(new InitDb());
var db = new EvlContext1();
var evl = new DbEventLog
{
Name = "GS.Trade.EventLog",
Alias = "GS.Trade.EventLog",
Code = "GS.Trade.EventLog",
Description = "GS.Trade.EventLog",
};
db.EventLogs.Add(evl);
db.SaveChanges();
In the Database Project
public class InitDb : DropCreateDatabaseIfModelChanges<ConfigurationContext>
{
protected override void Seed(ConfigurationContext db)
{
}
}
public class Initializer : DropCreateDatabaseIfModelChanges<EvlContext1>
{
protected override void Seed(EvlContext1 db)
{
Console.WriteLine("Initialize DataBase");
var evl = new DbEventLog
{
Name = "GS.Trade.EventLog",
Alias = "GS.Trade.EventLog",
Code = "GS.Trade.EventLog",
Description = "GS.Trade.EventLog",
};
db.EventLogs.Add(evl);
db.SaveChanges();
}
}
понедельник, 14 декабря 2015 г.
EntityFramework DateTime Data Annotation
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime EnrollmentDate { get; set; }
http://www.asp.net/mvc/overview/older-versions/getting-started-with-ef-5-using-mvc-4/creating-a-more-complex-data-model-for-an-asp-net-mvc-application
http://stackoverflow.com/questions/5252979/assign-format-of-datetime-with-data-annotations
http://stackoverflow.com/questions/23413625/entity-framework-default-datetime-annotation-does-not-migrate
AsNoTracking()
https://msdn.microsoft.com/en-us/data/jj556203
using (var context = new BloggingContext())
{
// Query for all blogs without tracking them
var blogs1 = context.Blogs.AsNoTracking();
// Query for some blogs without tracking them
var blogs2 = context.Blogs
.Where(b => b.Name.Contains(".NET"))
.AsNoTracking()
.ToList();
}
суббота, 28 ноября 2015 г.
EntityFramework, Web Api, MVC Async Operation
http://stackoverflow.com/questions/29168188/asp-net-web-api-2-async-action-methods-with-task-run-performance
https://msdn.microsoft.com/en-us/data/jj819165.aspx
https://msdn.microsoft.com/ru-ru/library/hh191443.aspx
http://stackoverflow.com/questions/25204336/why-dbsettentity-doesnt-implement-enumerableasync
http://stackoverflow.com/questions/21631774/entityframework-dbcontext-and-using-async
http://www.asp.net/mvc/overview/performance/using-asynchronous-methods-in-aspnet-mvc-4
http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html
https://www.simple-talk.com/dotnet/.net-framework/the-.net-4.5-asyncawait-feature-in-promise-and-practice/
http://blog.tonysneed.com/2013/03/22/async-services-asp-net-web-api-entity-framework-6/
http://www.c-sharpcorner.com/UploadFile/2b481f/create-asynchronous-action-method-in-web-api/
пятница, 27 ноября 2015 г.
EF Stored procedures
https://msdn.microsoft.com/en-us/data/ee712907#codefirst
https://msdn.microsoft.com/en-us/data/dn468673.aspx
https://msdn.microsoft.com/en-us/data/jj691402.aspx
http://www.codeproject.com/Articles/179481/Code-First-Stored-Procedures
https://codefirstfunctions.codeplex.com/
http://www.entityframeworktutorial.net/EntityFramework6/code-first-insert-update-delete-stored-procedure-mapping.aspx
http://www.c-sharpcorner.com/UploadFile/ff2f08/code-first-stored-procedure-entity-framework-6-0/
http://stackoverflow.com/questions/20901419/how-to-call-stored-procedure-in-entity-framework-6-code-first
Подписаться на:
Сообщения (Atom)