OfferItem offerItem;
using (Rainbow3Entities db = new Rainbow3Entities())
{
offerItem = db.OfferItem.First();
}
var prId = offerItem.ProductID;
var ofId = offerItem.OfferID;
offerItem.Name = "dummy";
using (Rainbow3Entities db = new Rainbow3Entities())
{
OfferItem offerItemFromDB = db.Set<OfferItem>().Find(offerItem.ProductID, offerItem.OfferID);
db.Entry<OfferItem>(offerItemFromDB).CurrentValues.SetValues(offerItem);
db.SaveChanges();
}
Sep 29, 2014
Entity Framework 6 - save changes with values from entity obtained out of context
When saving using Entity Framework changes in Db entity values for updating for existing Entity can be provided by helper SetValues:
Sep 24, 2014
MS SQL Data compare and sync tools
I've search this for too long so here is one comprehensive list in one place:
http://www.agile-code.com/blog/choose-your-sql-server-schema-comparison-tool/
http://www.agile-code.com/blog/choose-your-sql-server-schema-comparison-tool/
Sep 17, 2014
Entity Framework - Don't save object graph in disconnected DbContexts
Don't use disconnected DbContexts when you want to save object graph !
Either perform object graph building and save in same DbContext either use foreign keys.
Read more:
http://msdn.microsoft.com/en-us/magazine/dn166926.aspx
Either perform object graph building and save in same DbContext either use foreign keys.
Read more:
http://msdn.microsoft.com/en-us/magazine/dn166926.aspx
Sep 10, 2014
DotNetNuke tips
DNN 7.3 +
Must read !
Proper registration of custon Javascripts and CSS to support minification and bundle-ing;
http://www.dnnsoftware.com/wiki/client-resource-management-api
DNN 7.3.2 Default DNN menu module DDRMenu
~/DesktopModule/DDRMenu/Menu.ascx
User for MenuStyle="bootstrapNav".
You'll find this menu template in Gravity skin
For example:
...\Portals\_default\Skins\Gravity\bootstrapNav\
You may copy it to your DesktopModule/DDRMenu folder or use it from your skin folder.
DNN 4.9.5. Anatomy of url in DNN. All of below urls target same DNN page XXX:
- www.acme.com/Default.aspx?tabid=XXX
- www.acme.com/tabid/XXX/Default.aspx
- www.acme.com/AnyTextYouLike/CanBeHere/tabid/XXX/Default.aspx
There is only one catch. If you want to have physical folder in your root (virtual directory) then you don't use tabid:
- www.acme.com/german/Default.aspx
In this case german is folder in web root.
DNN (4.9.5 ?) helper for accessing physical home DNN directory of active portal:
DNN (4.9.5 ?) helper for accessing physical home DNN directory of active portal:
DotNetNuke.Common.Globals.GetPortalSettings().HomeDirectory
Sep 4, 2014
MS SQL Can't drop user since it is DBO
You are trying to drop user from Security/Users and get error something like "Can't drop user who owns schema ..."
Useful link:
http://www.mssqltips.com/sqlservertip/2620/steps-to-drop-an-orphan-sql-server-user-when-it-owns-a-schema-or-role/
Further actions were needed for me.
Go to Schemas, find schema in question ( e.g. db_owner) -> Properties -> change Schema owner to "dbo".
This will release user in question and you should be able to drop it.
Useful link:
http://www.mssqltips.com/sqlservertip/2620/steps-to-drop-an-orphan-sql-server-user-when-it-owns-a-schema-or-role/
Further actions were needed for me.
Go to Schemas, find schema in question ( e.g. db_owner) -> Properties -> change Schema owner to "dbo".
This will release user in question and you should be able to drop it.
Subscribe to:
Posts (Atom)