public int AddTag(string tagName) { using (geekinsidekmsEntities context = new geekinsidekmsEntities()) { Tag dbTag = new Tag { TagName = tagName }; try { context.AddToTags(dbTag); context.SaveChanges(System.Data.Objects.SaveOptions.DetectChangesBeforeSave); }catch(Exception e){ System.Diagnostics.Debug.WriteLine(e.InnerException.Message); } return dbTag.Id; } }
public static void Setup(int testItems) { SetTestRepo(); for(int i=0;i<testItems;i++){ Tag item=new Tag(); _testRepo._items.Add(item); } }
public static void Setup(Tag item) { SetTestRepo(); _testRepo._items.Add(item); }
/// <summary> /// Create a new Tag object. /// </summary> /// <param name="tagID">Initial value of the TagID property.</param> /// <param name="createDate">Initial value of the CreateDate property.</param> /// <param name="portalID">Initial value of the PortalID property.</param> /// <param name="contentID">Initial value of the ContentID property.</param> /// <param name="tag1">Initial value of the Tag1 property.</param> public static Tag CreateTag(global::System.Int32 tagID, global::System.DateTime createDate, global::System.Int32 portalID, global::System.Int32 contentID, global::System.String tag1) { Tag tag = new Tag(); tag.TagID = tagID; tag.CreateDate = createDate; tag.PortalID = portalID; tag.ContentID = contentID; tag.Tag1 = tag1; return tag; }
/// <summary> /// Deprecated Method for adding a new object to the Tags EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTags(Tag tag) { base.AddObject("Tags", tag); }
/// <summary> /// 创建新的 Tag 对象。 /// </summary> /// <param name="id">Id 属性的初始值。</param> /// <param name="tagName">TagName 属性的初始值。</param> public static Tag CreateTag(global::System.Int32 id, global::System.String tagName) { Tag tag = new Tag(); tag.Id = id; tag.TagName = tagName; return tag; }