The solution of the secondary development of Revit
According to the current procedure, there are several improvements
1 after each revit generation, the log will not be del. The next time it is generated, if you find that there is a log, it will not be generated again. By changing the name of the log to a timestamp, an independent log file is generated each time it is run.
Sample code
String date = DateTime.Now.ToLongDateString () .ToString () + DateTime.Now.ToLongTimeString ()
Date = date.Replace (":", "_")
Roller.File = @ "EventLogByrevit" + date + ".txt"
This code is placed in log.cs. Execute in the command of revit. This method is useful when debugging.
2 in the Model class, add a library that drop the original each time, and regenerate a library separately.
Added to the constructor in the Model class
Database.SetInitializer (new DropCreateDatabaseAlways ())
3 add a time field to DB to see when the data was saved.
4 add a file name field to DB, which is the full-text file name, so when setting this property in the class, keep it about 1000 characters. Otherwise, some of them will be very long and will make a mistake when keeping them.
5 when maintaining, because there are more builds, download the build from the website
On the console of Negut, execute the following command
Install-Package Z.EntityFramework.Extensions-Version 3.22.6
An Extension is installed, which supports batch retention.
6 if the amount of data is still very large, then the data is divided into 10000 units. The method of dividing can be referred to.
List templist = new List (); int separate = 10000; int mod integers = count / separate; int mod remainder = count% separate; for (int j = 1; j