public CIDRSettingModel Add(CIDRSettingModel model) { if (model == null) { throw new MobileException("非法的CIDRSettingModel参数,model 不能为空."); } model.ID = Guid.NewGuid().ToString(); cidrsetting item = new cidrsetting { ID = model.ID, CreatedBy = model.CreatedBy, CreatedDate = DateTime.Now, LastUpdatedBy = model.CreatedBy, LastUpdatedDate = DateTime.Now, IPStart = model.IPStart, IPStartNum = IPHelper.IPToNumber(model.IPStart), IPEnd = model.IPEnd, IPEndNum = IPHelper.IPToNumber(model.IPEnd), TCPPort = model.TCPPort, TTLThreshold = model.TTLFaZhi, TCPThreshold = model.TCPFaZhi, TTLExceptionKeys = model.TTLExceptionKeys }; using (var dbContext = new DataEntities()) { dbContext.cidrsettings.AddObject(item); dbContext.SaveChanges(); } return model; }
/// <summary> /// 创建新的 cidrsetting 对象。 /// </summary> /// <param name="id">ID 属性的初始值。</param> /// <param name="iPStart">IPStart 属性的初始值。</param> /// <param name="iPEnd">IPEnd 属性的初始值。</param> /// <param name="iPStartNum">IPStartNum 属性的初始值。</param> /// <param name="iPEndNum">IPEndNum 属性的初始值。</param> /// <param name="tCPThreshold">TCPThreshold 属性的初始值。</param> /// <param name="tCPPort">TCPPort 属性的初始值。</param> /// <param name="tTLThreshold">TTLThreshold 属性的初始值。</param> /// <param name="createdBy">CreatedBy 属性的初始值。</param> /// <param name="createdDate">CreatedDate 属性的初始值。</param> /// <param name="lastUpdatedBy">LastUpdatedBy 属性的初始值。</param> /// <param name="lastUpdatedDate">LastUpdatedDate 属性的初始值。</param> public static cidrsetting Createcidrsetting(global::System.String id, global::System.String iPStart, global::System.String iPEnd, global::System.Int64 iPStartNum, global::System.Int64 iPEndNum, global::System.Int32 tCPThreshold, global::System.Int32 tCPPort, global::System.Int32 tTLThreshold, global::System.String createdBy, global::System.DateTime createdDate, global::System.String lastUpdatedBy, global::System.DateTime lastUpdatedDate) { cidrsetting cidrsetting = new cidrsetting(); cidrsetting.ID = id; cidrsetting.IPStart = iPStart; cidrsetting.IPEnd = iPEnd; cidrsetting.IPStartNum = iPStartNum; cidrsetting.IPEndNum = iPEndNum; cidrsetting.TCPThreshold = tCPThreshold; cidrsetting.TCPPort = tCPPort; cidrsetting.TTLThreshold = tTLThreshold; cidrsetting.CreatedBy = createdBy; cidrsetting.CreatedDate = createdDate; cidrsetting.LastUpdatedBy = lastUpdatedBy; cidrsetting.LastUpdatedDate = lastUpdatedDate; return cidrsetting; }
/// <summary> /// 用于向 cidrsettings EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddTocidrsettings(cidrsetting cidrsetting) { base.AddObject("cidrsettings", cidrsetting); }