Skip to content

Instantly share code, notes, and snippets.

@tombowers
tombowers / delete-with-select.cs
Last active March 8, 2023 04:32
Entity Framework - Update without Select
var id = 1;
using (var db = new entityContext())
{
// Select entity
var entity = db.dbset.FirstOrDefault(e => e.ID == id);
if (entity != null)
{
// Remove Entity
db.dbset.Remove(entity);
db.SaveChanges();
@rzubek
rzubek / Characters.cs
Created December 27, 2017 20:40
Unity C# script loading at runtime
// note: this interface will be referenced in loaded source code:
public interface ICharacter
{
int Height { get; }
string Language { get; }
}
public class Human : ICharacter
{
public int Height { get { return UnityEngine.Random.Range(150, 200); } }